Relating controllers... How to?

Hi, anyone can help me?
I have 2 model : Error and Error Detail

Error: Error_name, tot_errors
Error Detail: Error_name , details for error

e.g.

Error = Error_type1 | 5
Error Detail = 5 lines with Error_name=Error_type1

I want to show this:


Error_type1 | 5 | Show Error Detail Link

then I put in " Show Error Detail Link " a <%= link_to
“Show”, :controller => “error_details” ,:action =>
“index”, :task_errore => error.type %>
and create method in error_details controller as

def index(task_errore)
if !session[:user_id]
redirect_to :controller => ‘user’, :action => ‘login’
else

    @ngn_errors = NgnError.find(:all, :conditions =>[" task_errore

= nvl(?, task_errore) ", task_errore ])

end

end

But when I click on link he say me:
ArgumentError in NgnerrorsController#index

wrong number of arguments (0 for 1)

and when I check logs

Processing NgnErrorsController#index (for 10.139.246.114 at 2009-12-30
15:07:10) [GET]
Parameters: {“task_errore”=>“Gestione Errore PCMS”}

ArgumentError (wrong number of arguments (0 for 1)):
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:95:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/local/lib/ruby/1.8/webrick/server.rb:92:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:instart’

Rendered rescues/_trace (113.5ms)
Rendered rescues/_request_and_response (2.3ms)
Rendering rescues/layout (internal_server_error)

Please help me!!! what’s the matter??

You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Ro wrote:

then I put in " Show Error Detail Link " a <%= link_to
“Show”, :controller => “error_details” ,:action =>
“index”, :task_errore => error.type %>
and create method in error_details controller as

def index(task_errore)
if !session[:user_id]
redirect_to :controller => ‘user’, :action => ‘login’
else

    @ngn_errors = NgnError.find(:all, :conditions =>[" task_errore

= nvl(?, task_errore) ", task_errore ])

end

end

But when I click on link he say me:
ArgumentError in NgnerrorsController#index

wrong number of arguments (0 for 1)

Controller actions don’t take arguments. You need to pass :task_errore
in the params hash (params[:task_errore]).

def index
task_errore = params[:task_errore]

end

Or something to that effect.

Thank you! this works!!!

Happy new year!

On Dec 30 2009, 6:00 pm, Robert W. [email protected] wrote:

Posted viahttp://www.ruby-forum.com/.

You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.