module ActiveScaffold
This module attempts to create permissions conventions for your ActiveRecord
models. It supports english-based methods that let you restrict access per-model, per-record, per-column, per-action, and per-user. All at once.
You may define instance methods in the following formats:
def #{column}_authorized_for_#{action}? def #{column}_authorized? def authorized_for_#{action}?
Your methods should allow for the following special cases:
* cron scripts * guest users (or nil current_user objects)
wrap the action rendering for ActiveScaffold
controllers
require ‘rails/generators/rails/scaffold_controller/scaffold_controller_generator’
require ‘generators/active_scaffold_controller/active_scaffold_controller_generator’
require ‘generators/active_scaffold_controller/active_scaffold_controller_generator’
Public Class Methods
autoload_subdir(dir, mod = self, root = File.dirname(__FILE__))
click to toggle source
# File lib/active_scaffold.rb, line 18 def self.autoload_subdir(dir, mod = self, root = File.dirname(__FILE__)) Dir["#{root}/active_scaffold/#{dir}/*.rb"].each do |file| basename = File.basename(file, '.rb') mod.module_eval do autoload basename.camelcase.to_sym, "active_scaffold/#{dir}/#{basename}" end end end
defaults(&block)
click to toggle source
# File lib/active_scaffold.rb, line 95 def self.defaults(&block) ActiveScaffold::Config::Core.configure(&block) end
exclude_bridges()
click to toggle source
# File lib/active_scaffold.rb, line 85 def self.exclude_bridges @@exclude_bridges ||= [] end
jquery_ui_included?()
click to toggle source
# File lib/active_scaffold.rb, line 70 def self.jquery_ui_included? return true if @@jquery_ui_loaded Jquery::Rails.const_defined?('JQUERY_UI_VERSION') || Jquery.const_defined?('Ui') if Object.const_defined?('Jquery') end
js_config()
click to toggle source
# File lib/active_scaffold.rb, line 76 def self.js_config @@js_config ||= {:scroll_on_close => :checkInViewport} end
js_framework()
click to toggle source
# File lib/active_scaffold.rb, line 60 def self.js_framework @@js_framework ||= if defined? Jquery :jquery elsif defined? PrototypeRails :prototype end end
root()
click to toggle source
# File lib/active_scaffold.rb, line 91 def self.root File.dirname(__FILE__) + '/..' end
threadsafe!()
click to toggle source
# File lib/active_scaffold.rb, line 55 def self.threadsafe! @@threadsafe = true end