Remove danging :photos table and other photo cruft
This commit is contained in:
parent
1ce834391a
commit
ae55c2772f
7 changed files with 15 additions and 37 deletions
|
|
@ -185,7 +185,7 @@ module Admin
|
||||||
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
||||||
:vpositions_attributes, :use_volunteers, :color,
|
:vpositions_attributes, :use_volunteers, :color,
|
||||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||||
:photos_attributes, :targets, :targets_attributes,
|
:targets, :targets_attributes,
|
||||||
:campaigns, :campaigns_attributes, :registration_limit)
|
:campaigns, :campaigns_attributes, :registration_limit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,6 @@ class ConferenceController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def gallery_photos
|
|
||||||
@photos = @conference.photos
|
|
||||||
render 'photos', formats: [:js]
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def respond_to_options
|
def respond_to_options
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ class Conference < ActiveRecord::Base
|
||||||
has_many :vpositions, dependent: :destroy
|
has_many :vpositions, dependent: :destroy
|
||||||
has_many :sponsorship_levels, -> { order('position ASC') }, dependent: :destroy
|
has_many :sponsorship_levels, -> { order('position ASC') }, dependent: :destroy
|
||||||
has_many :sponsors, dependent: :destroy
|
has_many :sponsors, dependent: :destroy
|
||||||
has_many :photos, dependent: :destroy
|
|
||||||
has_many :targets, dependent: :destroy
|
has_many :targets, dependent: :destroy
|
||||||
has_many :campaigns, dependent: :destroy
|
has_many :campaigns, dependent: :destroy
|
||||||
has_many :commercials, as: :commercialable, dependent: :destroy
|
has_many :commercials, as: :commercialable, dependent: :destroy
|
||||||
|
|
@ -44,7 +43,6 @@ class Conference < ActiveRecord::Base
|
||||||
accepts_nested_attributes_for :questions, allow_destroy: true
|
accepts_nested_attributes_for :questions, allow_destroy: true
|
||||||
accepts_nested_attributes_for :vdays, allow_destroy: true
|
accepts_nested_attributes_for :vdays, allow_destroy: true
|
||||||
accepts_nested_attributes_for :vpositions, allow_destroy: true
|
accepts_nested_attributes_for :vpositions, allow_destroy: true
|
||||||
accepts_nested_attributes_for :photos, allow_destroy: true
|
|
||||||
accepts_nested_attributes_for :targets, allow_destroy: true
|
accepts_nested_attributes_for :targets, allow_destroy: true
|
||||||
accepts_nested_attributes_for :campaigns, allow_destroy: true
|
accepts_nested_attributes_for :campaigns, allow_destroy: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
class Photo < ActiveRecord::Base
|
|
||||||
belongs_to :conference
|
|
||||||
validates_presence_of :picture
|
|
||||||
has_attached_file :picture,
|
|
||||||
styles: { thumb: '100x100>', large: '300x300>', banner: '600x300>' }
|
|
||||||
|
|
||||||
validates_attachment_content_type :picture,
|
|
||||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
|
||||||
size: { in: 0..500.kilobytes }
|
|
||||||
end
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
- photos.each_with_index do |photo,index|
|
|
||||||
%div.item{ class: (index==0? 'active' : '') }
|
|
||||||
= image_tag(photo.picture(:banner))
|
|
||||||
- unless photo.description.blank?
|
|
||||||
%div.carousel-caption
|
|
||||||
.lead
|
|
||||||
= photo.description
|
|
||||||
13
db/migrate/20160427101444_remove_photos.rb
Normal file
13
db/migrate/20160427101444_remove_photos.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
class RemovePhotos < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
drop_table :photos do |t|
|
||||||
|
t.text :description
|
||||||
|
t.string :picture_file_name
|
||||||
|
t.string :picture_content_type
|
||||||
|
t.integer :picture_file_size
|
||||||
|
t.datetime :picture_updated_at
|
||||||
|
t.belongs_to :conference
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
13
db/schema.rb
13
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160403214841) do
|
ActiveRecord::Schema.define(version: 20160427101444) do
|
||||||
|
|
||||||
create_table "ahoy_events", force: :cascade do |t|
|
create_table "ahoy_events", force: :cascade do |t|
|
||||||
t.uuid "visit_id", limit: 16
|
t.uuid "visit_id", limit: 16
|
||||||
|
|
@ -257,17 +257,6 @@ ActiveRecord::Schema.define(version: 20160403214841) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "photos", force: :cascade do |t|
|
|
||||||
t.text "description"
|
|
||||||
t.string "picture_file_name"
|
|
||||||
t.string "picture_content_type"
|
|
||||||
t.integer "picture_file_size"
|
|
||||||
t.datetime "picture_updated_at"
|
|
||||||
t.integer "conference_id"
|
|
||||||
t.datetime "created_at"
|
|
||||||
t.datetime "updated_at"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "programs", force: :cascade do |t|
|
create_table "programs", force: :cascade do |t|
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.integer "rating", default: 0
|
t.integer "rating", default: 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue