Ruby on Rails: link_to acting weird

So.. here is my link_to

  • <%= link_to "Archive", :action => 'archive' %>
  • and my output in the console

     Parameters: {"action"=>"archive", "controller"=>"achievables"}
    

    why is the action not "archive" ? the method is defined in the controller... spelled correctly and everything.

    EDIT: from routes.rb

      map.archives 'achievable/archive', :controller => 'achievables', :action => 'archive'
    
      map.resources :achievables, :member => {:build => [:get,:post], :publish_detail => [:get,:post], :publish=>[:get,:post], :confirm_publish=>[:get,:post], :confirm_delete=>[:get,:post]}
    

    right now, the error is

    Showing app/views/layouts/build_archivable.html.erb where line #6 raised:
    
    Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
    

    which, again, is the wrong path. =\

    Answers


    Try specifying the action as a string rather than a symbol:

    <%= link_to 'Archive', :action => 'archive' %>
    

    Alternatively, you might have a higher priority route defined within config/routes.rb that is getting matched before the default /:controller/:action/:id route (Rails starts at the top of the file and works downwards until to hits a route that matches the URL).


    Need Your Help

    Crystal Server / Business Objects Enterprise custom recurrence schedule

    crystal-reports business-objects crystal-reports-server

    We have a Crystal Server with SAP Business Objects Enterprise. In SAP's Central Management Console (CMC) I'm trying to schedule a report to run every 15 minutes (easy) but only run during business ...

    No way to delete IndexedDB under Google Chrome

    google-chrome privacy indexeddb

    How to delete IndexedDBs in Google Chrome? I've performed "Clear browsing data" and nothing happened. There is still bunch of IndexedDB from different domains... All other data has been removed.