Class: Adminpanel::Page

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Base
Defined in:
app/models/adminpanel/page.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#correlative_order_gallery, #destroy_unattached_images

Class Method Details

.mount_uploader(attribute, uploader) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/adminpanel/page.rb', line 5

def self.mount_uploader(attribute, uploader)
  super attribute, uploader
  define_method "#{attribute}_will_change!" do
    fields_will_change!
    instance_variable_set("@#{attribute}_changed", true)
  end
  define_method "#{attribute}_changed?" do
    instance_variable_get("@#{attribute}_changed")
  end
  define_method "write_uploader" do |column, identifier|
    fields[column.to_s] = identifier
  end
  define_method "read_uploader" do |column|
    fields[column.to_s]
  end
end

.whitelisted_attributes(params) ⇒ Object



22
23
24
# File 'app/models/adminpanel/page.rb', line 22

def self.whitelisted_attributes(params)
  params.require(self.name.to_s.underscore.split('/').last).permit!
end

Instance Method Details

#read_uploader(column) ⇒ Object



30
31
# File 'app/models/adminpanel/page.rb', line 30

def read_uploader(column)
end

#write_uploader(column, identifier) ⇒ Object



26
27
28
# File 'app/models/adminpanel/page.rb', line 26

def write_uploader(column, identifier)

end