Adds migration for banner photo

This commit is contained in:
Gopesh Tulsyan 2014-06-20 18:41:08 +05:30
parent 89df9a41d3
commit e731a6b58f
3 changed files with 24 additions and 6 deletions

View file

@ -20,7 +20,7 @@ class Conference < ActiveRecord::Base
:include_sponsors_in_splash, :include_tracks_in_splash,
:include_tickets_in_splash, :include_social_media_in_splash,
:include_program_in_splash, :make_conference_public,
:photos_attributes
:photos_attributes, :banner_photo
has_paper_trail
@ -63,12 +63,18 @@ class Conference < ActiveRecord::Base
accepts_nested_attributes_for :photos, allow_destroy: true
has_attached_file :logo,
:styles => {:thumb => "100x100>", :large => "300x300>" }
styles: { thumb: '100x100>', large: '300x300>' }
validates_attachment_content_type :logo,
:content_type => [/jpg/, /jpeg/, /png/, /gif/],
:size => { :in => 0..500.kilobytes }
content_type: [/jpg/, /jpeg/, /png/, /gif/],
size: { in: 0..500.kilobytes }
has_attached_file :banner_photo,
styles: { thumb: '100x100>', large: '1300x700>' }
validates_attachment_content_type :banner_photo,
content_type: [/jpg/, /jpeg/, /png/, /gif/],
size: { in: 0..500.kilobytes }
validates_presence_of :title,
:short_title,
:social_tag,

View file

@ -0,0 +1,8 @@
class AddBannerPhotoToConference < ActiveRecord::Migration
def change
add_column :conferences, :banner_photo_file_name, :string
add_column :conferences, :banner_photo_content_type, :string
add_column :conferences, :banner_photo_file_size, :integer
add_column :conferences, :banner_photo_updated_at, :datetime
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140618062623) do
ActiveRecord::Schema.define(version: 20140620130306) do
create_table "answers", force: true do |t|
t.string "title"
@ -94,7 +94,11 @@ ActiveRecord::Schema.define(version: 20140618062623) do
t.boolean "include_tickets_in_splash", default: false
t.boolean "include_social_media_in_splash", default: false
t.boolean "include_program_in_splash", default: false
t.boolean "make_conference_public", default: false
t.boolean "make_conference_public", default: false
t.string "banner_photo_file_name"
t.string "banner_photo_content_type"
t.integer "banner_photo_file_size"
t.datetime "banner_photo_updated_at"
end
create_table "conferences_questions", id: false, force: true do |t|