How to define a custom path in rails?

前端 未结 3 1145
遥遥无期
遥遥无期 2021-02-15 13:40

I have a User model. If I do:

def my_action
  @user = User.new
end

then

  <% form_for(@user) do |f| %>

3条回答
  •  感情败类
    2021-02-15 14:17

    You can also customize restful routes. For example in my application only the index and show actions are appropriate for certain controllers. In my routes.rb file I have some routes like this:

    map.resources :announcements, :only => [:index, :show]
    

    You can also use :except if that's more appropriate.

提交回复
热议问题