Module: Feste::Authenticatable
- Extended by:
- ActiveSupport::Concern
- Included in:
- SubscriptionsController
- Defined in:
- app/controllers/concerns/feste/authenticatable.rb
Instance Method Summary collapse
Instance Method Details
#find_or_create_subscriptions ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/controllers/concerns/feste/authenticatable.rb', line 32 def find_or_create_subscriptions Feste.[:categories].each do |category| Feste::Subscription.find_or_create_by( subscriber: subscriber, category: category ) end end |
#get_user_data ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/controllers/concerns/feste/authenticatable.rb', line 24 def get_user_data if subscriber.present? find_or_create_subscriptions else render file: "#{Rails.root}/public/404.html", status: 404 end end |
#subscriber ⇒ Object
19 20 21 22 |
# File 'app/controllers/concerns/feste/authenticatable.rb', line 19 def subscriber @_subscriber ||= Feste::Subscription.find_by(token: params[:token])&.subscriber || current_user end |