小编use*_*826的帖子

添加新的行动路线

我在用户控制器中获得了这些操作

class UsersController < ApplicationController
  def index #default action
    ...
  end

  def new #default action
    ...
  end

  def another_new
    ...
  end

  def create
    ...
  end

  def another_create
    ...
  end
end
Run Code Online (Sandbox Code Playgroud)

我希望能够通过 /users/another_new某种链接:method => :another_create 进行调用/users/another_new

我得到了以下config/routes.rb

get '/users/another_new' :to => 'users#another_new'
resources :users
Run Code Online (Sandbox Code Playgroud)

我的问题是,如果这是添加的正确方法get以及我如何添加another_create方法.

ruby routes ruby-on-rails

15
推荐指数
1
解决办法
1万
查看次数

标签 统计

routes ×1

ruby ×1

ruby-on-rails ×1