Module: AoCrudify::Base

Defined in:
lib/ao_crudify/base.rb

Class Method Summary collapse

Class Method Details

.append_features(base) ⇒ Object



35
36
37
38
39
# File 'lib/ao_crudify/base.rb', line 35

def self.append_features(base)
  super
  base.send(:include, AoCrudify::HookMethods)
  base.extend(AoCrudify::ClassMethods)
end

.default_options(model_name) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ao_crudify/base.rb', line 17

def self.default_options(model_name)
  singular_name = model_name.to_s
  plural_name = singular_name.pluralize
  class_name = singular_name.camelize
  {
    :title_attribute => singular_name,
    :singular_name => singular_name,
    :plural_name => plural_name,
    :class_name => class_name,
    :paginate => true,
    :order_by => :created_at,
    :direction => :numdesc,
    :conditions => {},
    :redirect_to_url => "admin_#{plural_name}_path",
    :log => Rails.env == 'development'
  }
end