Sha256: bbbe60c6c4294e069090286cdda508fd337ed395a2f57aae83abeb9acb01a94e
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require 'rails' require 'ixtlan/guard/guard_ng' require 'ixtlan/guard/guard_rails' require 'logger' require 'fileutils' module Ixtlan module Guard class Railtie < Rails::Railtie config.before_configuration do |app| app.config.guards_dir = File.join(Rails.root, "app", "guards") end config.after_initialize do |app| logger = app.config.logger || Rails.logger || Logger.new(STDERR) options = { :guards_dir => app.config.guards_dir, :cache => app.config.cache_classes } options[:logger] = logger unless defined?(Slf4r) FileUtils.mkdir_p(app.config.guards_dir) app.config.guard = Ixtlan::Guard::GuardNG.new(options) ::ActionController::Base.send(:include, Ixtlan::ActionController::Guard) ::ActionController::Base.send(:before_filter, :authorize) ::ActionView::Base.send(:include, Ixtlan::Allowed) end config.generators do require 'rails/generators' require 'rails/generators/rails/controller/controller_generator' Rails::Generators::ControllerGenerator.hook_for :guard, :type => :boolean, :default => true do |controller| invoke controller, [ class_name, actions ] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ixtlan-guard-0.7.2 | lib/ixtlan/guard/railtie.rb |