Sha256: d2bbb00bf34926a0ab81375bbf1c953ba30a9667c4dcfc2ddcf639b08f5153bc

Contents?: true

Size: 855 Bytes

Versions: 5

Compression:

Stored size: 855 Bytes

Contents

require 'polygallery'

module Polygallery
  module StrongParamsHelper
    def self.polygallery_params(title=:gallery, photos_title=:photos)
      {:"#{title}_attributes" => [:id, :title, :galleryable_id, :galleryable_type,
                                     :_destroy, polyphoto_params(photos_title) ] }
    end
    def self.polyphoto_params(title=:photos)
      {:"#{title}_attributes" => [:id, :photo, :photo_remote_url, :photo_to_upload,
                                  :title, :caption, :gallery_title, :gallery_id,
                                  :galleryable_id, :galleryable_type, :_destroy] }
    end
    def polygallery_params(title=:gallery, photos_title=:photos)
      StrongParamsHelper.polygallery_params title, photos_title end
    def polyphoto_params(title=:photos)
      StrongParamsHelper.polyphoto_params title
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
polygallery-0.4.8 lib/polygallery/strong_params_helper.rb
polygallery-0.4.7 lib/polygallery/strong_params_helper.rb
polygallery-0.4.6 lib/polygallery/strong_params_helper.rb
polygallery-0.4.5 lib/polygallery/strong_params_helper.rb
polygallery-0.4.4 lib/polygallery/strong_params_helper.rb