views:

159

answers:

2

Hi, I have a model 'Asset' and, on the show page, I have this:

<%= link_to_remote 'test', :url => { :controller 'looks', :action => 'whatever' } %>

The 'looks' controller and 'whatever' action both exist.

Now when I go the the show page for the second Asset and click the test link I get this error:

Processing AssetsController#2 (for 127.0.0.1 at 2009-12-03 17:09:57) [POST] Parameters: {"authenticity_token"=>"aLGRq+ZVulWbwC09m1dy7Mj9b9AgSJqkwiS99SLk6uk="} User Load (0.6ms) SELECT * FROM "users" WHERE ("users"."id" = '1') LIMIT 1

ActionController::UnknownAction (No action responded to 2. Actions: create, destroy, index, new, receive, and show): /usr/lib/ruby/gems/1.8/gems/chriseppstein-compass-0.8.17/lib/compass/app_integration/rails/action_controller.rb:7:in process' haml (2.3.0) lib/sass/plugin/rack.rb:44:in call' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:in start' /usr/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/lib/ruby/1.8/webrick/server.rb:92:in start' /usr/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/lib/ruby/1.8/webrick/server.rb:82:in start'

Rendering rescues/layout (not_found)

So apparently it's directing me to an action that's named whatever asset_id whose show I came from. If it helps, I'm using the authlogic and compass gems. I'd appreciate any help.

+2  A: 

Is that the exact code from your app? For starters, you are missing a => between :controller and 'looks'.

try <%= link_to_remote 'test', :url => { :controller => 'looks', :action => 'whatever' } %>

dl
A: 

In addition to what dl mentioned above, you are using link_to_remote, which is going to be updating a div on your page with the results of the action. You may mean to switch to link_to, since you suggest you expect to go somewhere.

Otherwise, if you want an ajax call, you should add a parameter to the link_to_remote call as follows:

<%= link_to_remote 'test',
                   :update => "some-div-id", 
                   :url => { :controller => 'looks', :action => 'whatever' } %>
MattMcKnight