user868711
user868711

Reputation: 27

Rails 3: named routes with shorthand notation

Let's say in Routes.rb, you have:

resources users
  member do
    post action1  # POST /users/:id/action1
    get action2  #GET  /users/:id/action2
  end
end

How can you name the path so that you can all, user_action1_path(@user)?

In the regular notation you can do

match "users/:id/action1", "users#action1", :as => :user_action1

But how do you do it using shorthand notation?

Thanks in advance!

Upvotes: 0

Views: 321

Answers (1)

Robin
Robin

Reputation: 21894

Do you really need that?

You already have action1_user_path(user) available.

Upvotes: 1

Related Questions