Class: EtabliocmsGalleries::Gallery
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- EtabliocmsGalleries::Gallery
- Defined in:
- app/models/etabliocms_galleries/gallery.rb
Instance Attribute Summary collapse
-
#attachable_temp ⇒ Object
Returns the value of attribute attachable_temp.
-
#pictures_array ⇒ Object
Returns the value of attribute pictures_array.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#attachable_temp ⇒ Object
Returns the value of attribute attachable_temp.
6 7 8 |
# File 'app/models/etabliocms_galleries/gallery.rb', line 6 def attachable_temp @attachable_temp end |
#pictures_array ⇒ Object
Returns the value of attribute pictures_array.
10 11 12 |
# File 'app/models/etabliocms_galleries/gallery.rb', line 10 def pictures_array @pictures_array end |
Class Method Details
.attachables_for_select ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/models/etabliocms_galleries/gallery.rb', line 32 def self.attachables_for_select sum = [] sum += EtabliocmsPages::Page.all if defined?(EtabliocmsPages) EtabliocmsGalleries.attachables.each { |string| sum += eval(string) } if EtabliocmsGalleries.attachables.present? sum.map { |item| title = item.is_a?(EtabliocmsPages::Page) ? "#{' '*2*item.level}#{item.title}" : item.title ["#{I18n.t("activerecord.attributes.#{item.class.to_s.underscore}.class_name")}: #{title}".html_safe, "#{item.class}##{item.id}"] } end |
Instance Method Details
#set_pictures ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/models/etabliocms_galleries/gallery.rb', line 22 def set_pictures if pictures_array.present? pictures_array.each do |file| pictures.build(:data => file, :title => file.original_filename, :position => pictures_array.index(file)) end end end |