I'm using Grape to build an API.
I created an ActiveSupport::Concern
let's say with the name Authentication
and I applied some before filter so my concern looks like:
module Authentication
extend ActiveSupport::Concern
included do
before do
error!('401 Unauthorized', 401) unless authenticated?
end
....
end
end
Now let's say in my UserController I want to apply this concern only for a specific action. How can I do that?
class SocialMessagesController < Grape::API
include Authentication
get '/action_one' do
end
get '/action_two' do
end
end
Any easy way to specify the concern for a specific method just like before_filter
in rails with only
option?