I’m using Rails and Devise gem. I want to PayPal account.
I have function:
def verify_paypal
............
end
I put it into user.rb. Added route, in routes.rb:
devise_for :users do
member do
get 'verify_paypal'
end
end
and get error
/mapper.rb:1189:in `member': can't use member outside resource(s) scope (ArgumentError)
What I’m doing wrong ?
First, you cannot call a block on
devise_for, it is not setup this way. Devise does provide a helper method that you can use that allows you to call a block on Devise routes. See the README.Second, Devise routes and scoping Devise routes, is only for Devise routes. Your method is not in any of the Devise controllers, therefore it cannot be called for Devise. You need to have a separate
users_controller.rbwith a method to callverify_paypalon the model. You can then setup your custom route in a block call onresources users. For more information on the Rails routing stack I would recommend reading, Rails Routing From the Outside In. This should give you all the information you need to make a call to your custom action.