Remove landing page images

This commit is contained in:
Rohan Mitchell
2014-07-16 15:15:57 +10:00
parent 19118da82e
commit b326ec8a3c
5 changed files with 18 additions and 35 deletions

View File

@@ -1,11 +0,0 @@
class LandingPageImage < ActiveRecord::Base
attr_accessible :photo
has_attached_file :photo, styles: { max_common_res: ["1920x1080#", :jpg] },
:convert_options => { max_common_res: "-quality 25" }
validates_attachment_presence :photo
def self.random
offset(rand(LandingPageImage.count)).first
end
end

View File

@@ -0,0 +1,16 @@
class DropLandingPageImages < ActiveRecord::Migration
def up
drop_table :landing_page_images
end
def down
create_table :landing_page_images do |t|
t.string :photo_file_name
t.string :photo_content_type
t.integer :photo_file_size
t.datetime :photo_updated_at
t.timestamps
end
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140702053145) do
ActiveRecord::Schema.define(:version => 20140716051214) do
create_table "adjustment_metadata", :force => true do |t|
t.integer "adjustment_id"
@@ -296,15 +296,6 @@ ActiveRecord::Schema.define(:version => 20140702053145) do
add_index "exchanges", ["receiver_id"], :name => "index_exchanges_on_receiver_id"
add_index "exchanges", ["sender_id"], :name => "index_exchanges_on_sender_id"
create_table "landing_page_images", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "photo_file_name"
t.string "photo_content_type"
t.integer "photo_file_size"
t.datetime "photo_updated_at"
end
create_table "order_cycles", :force => true do |t|
t.string "name"
t.datetime "orders_open_at"

View File

@@ -27,13 +27,6 @@ unless Spree::State.find_by_name 'Victoria'
end
end
# -- Landing page images
unless LandingPageImage.find_by_photo_file_name("potatoes.jpg")
LandingPageImage.create photo: File.open(File.join(Rails.root, "lib", "seed_data", "carrots.jpg"))
LandingPageImage.create photo: File.open(File.join(Rails.root, "lib", "seed_data", "tomatoes.jpg"))
LandingPageImage.create photo: File.open(File.join(Rails.root, "lib", "seed_data", "potatoes.jpg"))
end
# -- Seeding suburbs
# -- Suburbs
require_relative './suburb_seeds'
SuburbSeeder.seed_suburbs unless Suburb.find_by_name("Dayton")

View File

@@ -1,6 +0,0 @@
require 'spec_helper'
describe LandingPageImage do
it { should have_attached_file(:photo) }
it { should validate_attachment_presence(:photo) }
end