Class: GalleryPhotos
- Inherits:
-
Object
- Object
- GalleryPhotos
- Defined in:
- lib/components/gallery_photos.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(parent, params) ⇒ GalleryPhotos
constructor
A new instance of GalleryPhotos.
- #sort_gallery_photos_for_parent ⇒ Object
Constructor Details
#initialize(parent, params) ⇒ GalleryPhotos
Returns a new instance of GalleryPhotos.
5 6 7 8 |
# File 'lib/components/gallery_photos.rb', line 5 def initialize(parent, params) @parent = parent @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/components/gallery_photos.rb', line 3 def params @params end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
2 3 4 |
# File 'lib/components/gallery_photos.rb', line 2 def parent @parent end |
Instance Method Details
#sort_gallery_photos_for_parent ⇒ Object
10 11 12 13 14 |
# File 'lib/components/gallery_photos.rb', line 10 def sort_gallery_photos_for_parent params[:gallery_photos].each_with_index do |id, index| parent.gallery_photos.find(id).update_attributes(order: index+1) end end |