Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (43 sloc) 1.251 kb
require 'merit/rule'
require 'merit/rules_badge'
require 'merit/rules_points'
require 'merit/rules_rank'
require 'merit/controller_extensions'
require 'merit/model_additions'
module Merit
# Check rules on each request
mattr_accessor :checks_on_each_request
@@checks_on_each_request = true
# Define ORM
mattr_accessor :orm
@@orm = :active_record
# Define user_model_name
mattr_accessor :user_model_name
@@user_model_name = "User"
def self.user_model
@@user_model_name.constantize
end
# Define current_user_method
mattr_accessor :current_user_method
def self.current_user_method
@@current_user_method || "current_#{@@user_model_name.downcase}".to_sym
end
# Load configuration from initializer
def self.setup
yield self
end
class Engine < Rails::Engine
config.app_generators.orm Merit.orm
initializer 'merit.controller' do |app|
if Merit.orm == :active_record
require "merit/models/#{Merit.orm}/sash"
require "merit/models/#{Merit.orm}/badges_sash"
elsif Merit.orm == :mongoid
require "merit/models/#{Merit.orm}/sash"
end
ActiveSupport.on_load(:action_controller) do
include Merit::ControllerExtensions
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.