app/controllers/rostra/application_controller.rb in rostra-0.0.3 vs app/controllers/rostra/application_controller.rb in rostra-0.0.4
- old
+ new
@@ -1,25 +1,39 @@
module Rostra
class ApplicationController < ActionController::Base
- helper_method :user_logged_in?
+ include Rostra::Config
+ helper_method :user_logged_in?, :rostra_user, :main_app_login_path, :main_app_signup_path
+
rescue_from CanCan::AccessDenied do |exception|
after_access_denied
end
+ def rostra_user
+ send(Rostra::Config.rostra_user)
+ end
+
+ def main_app_login_path
+ send(:main_app).send(Rostra::Config.main_app_login_path)
+ end
+
+ def main_app_signup_path
+ send(:main_app).send(Rostra::Config.main_app_signup_path)
+ end
+
# Check if a user is logged in
#
def user_signed_in?
- current_user
+ rostra_user
end
private
# Override <tt>cancan</tt>'s default class of <tt>Ability</tt> to user <tt>Rostra::Ability</tt>.
#
def current_ability
- @current_ability ||= Rostra::Ability.new(current_user)
+ @current_ability ||= Rostra::Ability.new(rostra_user)
end
# Override this method to if finer control over what happens when <tt>cancan</tt> denies access.
#
def after_access_denied