How to define a custom path in rails?

前端 未结 3 1152
遥遥无期
遥遥无期 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:36

    You can map custom routes in your routes.rb file like this...

    map.users '/users', :controller => 'user', :action => 'index'
    

    This gives you the users_path helper you're looking for.

提交回复
热议问题