Sha256: 57b1b2304b0762ecc94d5ec4222a2fe21618e93b32f539267f6303cdb04264a6

Contents?: true

Size: 859 Bytes

Versions: 7

Compression:

Stored size: 859 Bytes

Contents

module Adminpanel
  class Page < ActiveRecord::Base
    include Adminpanel::Base

    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

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

    def write_uploader(column, identifier)

    end

    def read_uploader(column)
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adminpanel-3.6.1 app/models/adminpanel/page.rb
adminpanel-3.6.0 app/models/adminpanel/page.rb
adminpanel-3.5.1 app/models/adminpanel/page.rb
adminpanel-3.5.0 app/models/adminpanel/page.rb
adminpanel-3.4.7 app/models/adminpanel/page.rb
adminpanel-3.4.6 app/models/adminpanel/page.rb
adminpanel-3.4.5 app/models/adminpanel/page.rb