Module: ActiveScaffold

Defined in:
lib/active_scaffold/active_record_permissions.rb,
lib/active_scaffold.rb,
lib/active_scaffold/core.rb,
lib/active_scaffold/engine.rb,
lib/active_scaffold/finder.rb,
lib/active_scaffold/bridges.rb,
lib/active_scaffold/version.rb,
lib/active_scaffold/constraints.rb,
lib/active_scaffold/configurable.rb,
lib/active_scaffold/marked_model.rb,
lib/active_scaffold/delayed_setup.rb,
lib/active_scaffold/attribute_params.rb,
lib/active_scaffold/responds_to_parent.rb,
lib/active_scaffold/helpers/id_helpers.rb,
lib/active_scaffold/helpers/view_helpers.rb,
lib/active_scaffold/bridges/dragonfly/list_ui.rb,
lib/active_scaffold/bridges/paperclip/form_ui.rb,
lib/active_scaffold/bridges/paperclip/list_ui.rb,
lib/active_scaffold/bridges/dragonfly/form_ui.rb,
lib/active_scaffold/helpers/controller_helpers.rb,
lib/active_scaffold/helpers/pagination_helpers.rb,
lib/active_scaffold/bridges/shared/date_bridge.rb,
lib/active_scaffold/helpers/show_column_helpers.rb,
lib/active_scaffold/helpers/form_column_helpers.rb,
lib/active_scaffold/extensions/left_outer_joins.rb,
lib/active_scaffold/helpers/list_column_helpers.rb,
lib/active_scaffold/bridges/file_column/form_ui.rb,
lib/active_scaffold/bridges/file_column/list_ui.rb,
lib/active_scaffold/bridges/carrierwave/form_ui.rb,
lib/active_scaffold/bridges/carrierwave/list_ui.rb,
lib/active_scaffold/helpers/association_helpers.rb,
lib/active_scaffold/helpers/search_column_helpers.rb,
lib/active_scaffold/helpers/human_condition_helpers.rb,
lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb,
lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb,
lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb,
lib/active_scaffold/extensions/name_option_for_datetime.rb,
lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb,
lib/active_scaffold/bridges/file_column/file_column_helpers.rb,
lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb,
lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb,
lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb,
lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb

Overview

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)

Defined Under Namespace

Modules: Actions, ActiveRecordPermissions, AttributeParams, Bridges, Config, Configurable, Constraints, Core, DataStructures, DateSelectExtension, DelayedSetup, Finder, Helpers, MarkedModel, OuterJoins, RespondsToParent, UnsavedRecord, Version Classes: ActionNotAllowed, ControllerNotFound, Engine, MalformedConstraint, RecordNotAllowed, ReverseAssociationRequired, Tableless

Class Method Summary collapse

Class Method Details

.autoload_subdir(dir, mod = self, root = File.dirname(__FILE__)) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/active_scaffold.rb', line 15

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_bridgesObject



80
81
82
# File 'lib/active_scaffold.rb', line 80

def self.exclude_bridges
  @@exclude_bridges ||= []
end

.exclude_bridges=(bridges) ⇒ Object

exclude bridges you do not need, add to an initializer name of bridge subdir should be used to exclude it eg

ActiveScaffold.exclude_bridges = [:cancan, :ancestry]


76
77
78
# File 'lib/active_scaffold.rb', line 76

def self.exclude_bridges=(bridges)
  @@exclude_bridges = bridges
end

.js_configObject



68
69
70
# File 'lib/active_scaffold.rb', line 68

def self.js_config
  @@js_config ||= {:scroll_on_close => :checkInViewport}
end

.js_config=(config) ⇒ Object



64
65
66
# File 'lib/active_scaffold.rb', line 64

def self.js_config=(config)
  @@js_config = config
end

.js_frameworkObject



56
57
58
59
60
61
62
# File 'lib/active_scaffold.rb', line 56

def self.js_framework
  @@js_framework ||= if defined? Jquery
    :jquery
  elsif defined? PrototypeRails
    :prototype
  end
end

.js_framework=(framework) ⇒ Object



52
53
54
# File 'lib/active_scaffold.rb', line 52

def self.js_framework=(framework)
  @@js_framework = framework
end

.rootObject



84
85
86
# File 'lib/active_scaffold.rb', line 84

def self.root
  File.dirname(__FILE__) + "/.."
end

.set_defaults(&block) ⇒ Object



88
89
90
# File 'lib/active_scaffold.rb', line 88

def self.set_defaults(&block)
  ActiveScaffold::Config::Core.configure &block
end