Module: Refinery::Crud

Defined in:
core/lib/refinery/crud.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.append_features(base) ⇒ Object



44
45
46
47
# File 'core/lib/refinery/crud.rb', line 44

def self.append_features(base)
  super
  base.extend(ClassMethods)
end

.default_options(model_name) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'core/lib/refinery/crud.rb', line 20

def self.default_options(model_name)
  class_name = "#{model_name.to_s.camelize.gsub('/', '::')}".gsub('::::', '::')
  this_class = class_name.constantize.base_class
  singular_name = ActiveModel::Naming.param_key(this_class)
  plural_name = singular_name.pluralize

  {
    :conditions => '',
    :include => [],
    :order => ('position ASC' if this_class.table_exists? && this_class.column_names.include?('position')),
    :paging => true,
    :per_page => false,
    :redirect_to_url => "refinery.#{Refinery.route_for_model(class_name.constantize, true)}",
    :searchable => true,
    :search_conditions => '',
    :sortable => true,
    :title_attribute => "title",
    :xhr_paging => false,
    :class_name => class_name,
    :singular_name => singular_name,
    :plural_name => plural_name
  }
end