\'archive\' %> and my output in the console" />
开发者

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开发者_如何学Python 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. =\


    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).

    0

    上一篇:

    下一篇:

    精彩评论

    暂无评论...
    验证码 换一张
    取 消

    最新问答

    问答排行榜