我正在使用设计不可吸引的宝石:https://github.com/scambra/devise_invitable
我的应用还有一个控制器:invitations_controller.rb,它以以下内容开头:
class InvitationsController < Devise::InvitationsController
我允许用户向FB注册,并希望向此控制器添加一个方法:
def fb_create
Rails.logger.info 'fb_createfb_createfb_createfb_createfb_createfb_createfb_createfb_createfb_create'
end
我尝试将其添加到我的 routes.rb 文件中,如下所示:
post "/users/invitation/fb_create" => "invitations#fb_create"
但这失败了。如何为此方法添加路由?
目前我的路线一直在使用它进行设计:
devise_for :users, :controllers => {:invitations => "invitations", :sessions => "sessions", :registrations => "registrations"}
谢谢
devise_for :users, :controllers => {:invitations => "invitations", :sessions => "sessions", :registrations => "registrations"} do
post "/users/invitation/fb_create" => "invitations#fb_create", :as => "invitation_fb_create"
end
这将生成指向该操作invitation_fb_create_path帮助程序方法