Module: PaperclipI18n::ActsAsAttachment::ClassMethods
- Defined in:
- lib/paperclip_i18n/acts_as_attachment.rb
Instance Method Summary collapse
-
#acts_as_attachment(options = {}) ⇒ Object
Extends the model to afford the ability to associate other records with the receiving record.
Instance Method Details
#acts_as_attachment(options = {}) ⇒ Object
Extends the model to afford the ability to associate other records with the receiving record.
This module needs the paperclip plugin to work www.thoughtbot.com/projects/paperclip
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/paperclip_i18n/acts_as_attachment.rb', line 12 def ( = {}) = [:url] = "/uploads/#{Rails.env}/assets/:id_partition/:basename.:style.:extension" if [:url].blank? [:path] = "#{Rails.root}/public/uploads/#{Rails.env}/assets/:id_partition/:basename.:style.:extension" if [:path].blank? has_attached_file(:upload, ) belongs_to(:attachable, :polymorphic => true) scope(:i18ns, lambda { where(:upload_language => ::I18n.locale.to_s) }) include(::PaperclipI18n::ActsAsAttachment::InstanceMethods) end |