Skip to content

Commit

Permalink
Fixed image loading locally, S3 broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil Gehani committed Dec 7, 2015
1 parent 970ac45 commit 4817558
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 25 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ gem 'rails', '4.0.0'
gem 'jquery-rails'
gem 'devise'
gem 'simple_form', '~> 3.0.0.rc'
gem "paperclip", "~> 3.0"
gem "paperclip-dropbox"
gem "paperclip", "~> 4.3" #previously 3.0"
#gem "paperclip-dropbox"
gem 'aws-sdk', '~> 1.5.7'
gem "masonry-rails", '~> 0.2.0'
gem 'faker', "~> 1.2.0"
Expand All @@ -27,7 +27,7 @@ end


# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
gem 'sass-rails', '~> 4.0.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
Expand Down
33 changes: 15 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ GEM
tzinfo (~> 0.3.37)
acts_as_follower (0.2.1)
arel (4.0.1)
atomic (1.1.14)
aws-sdk (1.5.8)
httparty (~> 0.7)
json (~> 1.4)
Expand All @@ -44,7 +43,7 @@ GEM
builder (3.1.4)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.3)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.0)
coffee-rails (4.0.1)
Expand All @@ -60,8 +59,6 @@ GEM
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
dropbox-sdk (1.6.2)
json
erubis (2.7.0)
execjs (2.0.2)
faker (1.2.0)
Expand All @@ -70,7 +67,7 @@ GEM
httparty (0.12.0)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.6.9)
i18n (0.7.0)
jbuilder (1.2.0)
activesupport (>= 3.0.0)
jquery-rails (3.0.4)
Expand All @@ -86,21 +83,20 @@ GEM
masonry-rails (0.2.1)
rails
mime-types (1.25.1)
mimemagic (0.3.0)
mini_portile (0.5.2)
minitest (4.7.5)
multi_json (1.8.2)
multi_json (1.11.2)
multi_xml (0.5.5)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
orm_adapter (0.5.0)
paperclip (3.5.2)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
paperclip (4.3.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
cocaine (~> 0.5.5)
mime-types
paperclip-dropbox (1.1.7)
dropbox-sdk (~> 1.3)
paperclip (~> 3.1)
mimemagic (= 0.3.0)
pg (0.17.0)
polyglot (0.3.3)
protected_attributes (1.0.3)
Expand Down Expand Up @@ -151,15 +147,14 @@ GEM
sprockets (~> 2.8)
sqlite3 (1.3.8)
thor (0.18.1)
thread_safe (0.1.3)
atomic
thread_safe (0.3.5)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.0.0)
coffee-rails
tzinfo (0.3.38)
tzinfo (0.3.46)
uglifier (2.3.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
Expand All @@ -184,8 +179,7 @@ DEPENDENCIES
jquery-rails
jquery-turbolinks
masonry-rails (~> 0.2.0)
paperclip (~> 3.0)
paperclip-dropbox
paperclip (~> 4.3)
pg
protected_attributes
rails (= 4.0.0)
Expand All @@ -197,3 +191,6 @@ DEPENDENCIES
turbolinks
uglifier (>= 1.3.0)
will_paginate (~> 3.0.3)

BUNDLED WITH
1.10.6
5 changes: 5 additions & 0 deletions app/models/location.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Location < ActiveRecord::Base
attr_accessible :city, :state, :zip, :address, :lat, :lng

has_many :pins
end
1 change: 1 addition & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
config.assets.debug = true
#In production, :host should be set to the actual host of your application.
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
Paperclip.options[:command_path] = "/usr/local/bin/"
end
6 changes: 4 additions & 2 deletions config/initializers/paperclip.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# config/initializers/paperclip.rb
Paperclip::Attachment.default_options[:url] = ':event_sample_images.s3-website-us-east-1.amazonaws.com'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
unless Rails.env.development?
Paperclip::Attachment.default_options[:url] = ':event_sample_images.s3-website-us-east-1.amazonaws.com'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
end
14 changes: 14 additions & 0 deletions db/migrate/20131218231554_create_locations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class CreateLocations < ActiveRecord::Migration
def change
create_table :locations do |t|
t.string :address
t.string :city
t.string :state
t.string :zip
t.float :lat
t.float :lng

t.timestamps
end
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@
t.integer "image_file_size"
t.datetime "image_updated_at"
t.string "image_remote_url"
t.integer "location_id"
end

add_index "pins", ["user_id"], name: "index_pins_on_user_id"
add_index "pins", ["location_id"], name: "index_pins_on_location_id", unique: true

create_table "users", force: true do |t|
t.string "email", default: "", null: false
Expand All @@ -71,4 +69,5 @@

add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true

end
17 changes: 17 additions & 0 deletions test/fixtures/locations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html

one:
address: MyString
city: MyString
state: MyString
zip: MyString
lat: 1.5
lng: 1.5

two:
address: MyString
city: MyString
state: MyString
zip: MyString
lat: 1.5
lng: 1.5
7 changes: 7 additions & 0 deletions test/models/location_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'test_helper'

class LocationTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit 4817558

Please sign in to comment.