Skip to content

Commit

Permalink
Merge pull request #469 from djsegal/api/no-helpers
Browse files Browse the repository at this point in the history
Prevent helpers being loaded for Rails API’s
  • Loading branch information
booleanbetrayal committed Dec 14, 2015
2 parents 66ff79f + e388059 commit 27bca2f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/devise_token_auth/controllers/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def current_#{group_name.to_s.pluralize}
end.compact
end
helper_method "current_#{group_name}", "current_#{group_name.to_s.pluralize}", "#{group_name}_signed_in?"
if respond_to?(:helper_method)
helper_method "current_#{group_name}", "current_#{group_name.to_s.pluralize}", "#{group_name}_signed_in?"
end
METHODS
end

Expand Down Expand Up @@ -121,7 +123,9 @@ def #{mapping}_session
METHODS

ActiveSupport.on_load(:action_controller) do
helper_method "current_#{mapping}", "#{mapping}_signed_in?", "#{mapping}_session"
if respond_to?(:helper_method)
helper_method "current_#{mapping}", "#{mapping}_signed_in?", "#{mapping}_session"
end
end
end
end
Expand Down

0 comments on commit 27bca2f

Please sign in to comment.