module ActiveScaffold
Public Class Methods
autoload_subdir(dir, mod=self, root = File.dirname(__FILE__))
click to toggle source
# File lib/active_scaffold.rb, line 28 def self.autoload_subdir(dir, mod=self, root = File.dirname(__FILE__)) Dir["#{root}/active_scaffold/#{dir}/*.rb"].each { |file| basename = File.basename(file, ".rb") mod.module_eval { autoload basename.camelcase.to_sym, "active_scaffold/#{dir}/#{basename}" } } end
exclude_bridges()
click to toggle source
# File lib/active_scaffold.rb, line 120 def self.exclude_bridges @@exclude_bridges ||= [] end
exclude_bridges=(bridges)
click to toggle source
exclude bridges you do not need name of bridge subdir should be used to exclude it eg
ActiveScaffold.exclude_bridges = [:cancan, :ancestry] if you are using Activescaffold as a gem add to initializer if you are using Activescaffold as a plugin add to active_scaffold_env.rb
# File lib/active_scaffold.rb, line 116 def self.exclude_bridges=(bridges) @@exclude_bridges = bridges end
included(base)
click to toggle source
# File lib/active_scaffold.rb, line 64 def self.included(base) base.extend(ClassMethods) base.module_eval do # TODO: these should be in actions/core before_filter :handle_user_settings end end
js_framework()
click to toggle source
# File lib/active_scaffold.rb, line 106 def self.js_framework @@js_framework ||= :prototype end
js_framework=(framework)
click to toggle source
# File lib/active_scaffold.rb, line 102 def self.js_framework=(framework) @@js_framework = framework end
root()
click to toggle source
# File lib/active_scaffold.rb, line 124 def self.root File.dirname(__FILE__) + "/.." end
set_defaults(&block)
click to toggle source
# File lib/active_scaffold.rb, line 72 def self.set_defaults(&block) ActiveScaffold::Config::Core.configure &block end
Public Instance Methods
active_scaffold_config()
click to toggle source
# File lib/active_scaffold.rb, line 76 def active_scaffold_config self.class.active_scaffold_config end
active_scaffold_config_for(klass)
click to toggle source
# File lib/active_scaffold.rb, line 80 def active_scaffold_config_for(klass) self.class.active_scaffold_config_for(klass) end
active_scaffold_session_storage(id = (params[:eid] || params[:controller]))
click to toggle source
# File lib/active_scaffold.rb, line 84 def active_scaffold_session_storage(id = (params[:eid] || params[:controller])) session_index = "as:#{id}" session[session_index] ||= {} session[session_index] end
handle_user_settings()
click to toggle source
at some point we need to pass the session and params into config. we’ll just take care of that before any particular action occurs by passing those hashes off to the UserSettings class of each action.
# File lib/active_scaffold.rb, line 91 def handle_user_settings if self.class.uses_active_scaffold? active_scaffold_config.actions.each do |action_name| conf_instance = active_scaffold_config.send(action_name) rescue next next if conf_instance.class::UserSettings == ActiveScaffold::Config::Base::UserSettings # if it hasn't been extended, skip it active_scaffold_session_storage[action_name] ||= {} conf_instance.user = conf_instance.class::UserSettings.new(conf_instance, active_scaffold_session_storage[action_name], params) end end end