Greetings, all-knowing-ones,
I've been hacking at this error for hours now and I've run out of ideas. Using the component feature, I'm trying to pass two parameters from a view, through a helper, to the target controller, which then in turn passes the parameter to the model for incorporation into a DB query. I keep getting the error:
ArgumentError in Link managerController#show
wrong number of arguments (2 for 1)
I don't understand what is happening here, I'm passing two parameters and I'm using two parameters. Let me walk you through the relevant parts of my code:
the call to insert_context_menu is to a helper that looks like this:Code:<div id="wrapper"> <% if flash[:notice] -%> <div id="notice"><%= flash[:notice] %></div> <% end -%> <%= insert_context_menu%> <%= @content_for_layout %> </div>
So, I've assigned values to two parameters, cat and sub. The helper calls on the following action:Code:def insert_context_menu if @show_context render_component(:controller => 'LinkManager', :action => 'show', :params =>{"cat" => "admin","sub" =>"user_manager"}, :layout => nil) end end
I'm now calling on the model to query the database and return data I need to build context-sensitive hyper-links. I think I'm correctly passing the two parameters that orginated in the helper. Here's the method in the model:Code:def show @local_links = Link.get_links (params[:cat,:sub]) end
This query works fine when I tested by creating and setting two variables locally. But as soon as this whole thing runs, I get the wrong number of arguments error.Code:def self.get_links link.find(:first, :conditions => ["category = ? AND sub_category = ?", cat,sub]) end
Any help in restoring my sanity would be much appreciated!
Thanks!


