Module: Paperclip::Schema
- Defined in:
- lib/paperclip/schema.rb
Overview
Provides two helpers that can be used in migrations.
In order to use this module, the target class should implement a column
method that takes the column name and type, both as symbols, as well as a remove_column
method that takes a table and column name, also both symbols.
Constant Summary collapse
- @@columns =
{:file_name => :string, :content_type => :string, :file_size => :integer, :updated_at => :datetime}
Instance Method Summary collapse
- #drop_attached_file(table_name, attachment_name) ⇒ Object
- #has_attached_file(attachment_name) ⇒ Object
Instance Method Details
#drop_attached_file(table_name, attachment_name) ⇒ Object
20 21 22 23 24 |
# File 'lib/paperclip/schema.rb', line 20 def drop_attached_file(table_name, ) with_columns_for() do |column_name, column_type| remove_column(table_name, column_name) end end |
#has_attached_file(attachment_name) ⇒ Object
14 15 16 17 18 |
# File 'lib/paperclip/schema.rb', line 14 def has_attached_file() with_columns_for() do |column_name, column_type| column(column_name, column_type) end end |