How to define a custom path in rails?

前端 未结 3 1143
遥遥无期
遥遥无期 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条回答
  •  梦毁少年i
    2021-02-15 14:27

    Since I came here looking for a way to create helpers in routes.rb, here is the way to do it:

    get '/users/:id/' =>'users#show', :as => :user
    

提交回复
热议问题