Skip to content

Instantly share code, notes, and snippets.

@framallo
Created February 1, 2016 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save framallo/5767d5b077f9909c312f to your computer and use it in GitHub Desktop.
Save framallo/5767d5b077f9909c312f to your computer and use it in GitHub Desktop.
diff --git a/Gemfile b/Gemfile
index dd478e9..0454ddf 100644
--- a/Gemfile
+++ b/Gemfile
@@ -49,6 +49,7 @@ gem "geocoder"
gem "figaro", ">= 1.0.0"
gem 'carrierwave'
+gem 'rmagick'
gem "fog", "~> 1.3.1"
diff --git a/Gemfile.lock b/Gemfile.lock
index f5dc21d..2ce70df 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -115,6 +115,7 @@ GEM
json (~> 1.4)
responders (1.1.2)
railties (>= 3.2, < 4.2)
+ rmagick (2.15.4)
ruby-hmac (0.4.0)
sass (3.4.21)
sass-rails (5.0.4)
@@ -168,9 +169,13 @@ DEPENDENCIES
jquery-rails
pg
rails (= 4.0.1)
+ rmagick
sass-rails
sdoc
simple_form
sprockets (= 2.11.0)
uglifier (>= 1.3.0)
will_paginate (~> 3.0.6)
+
+BUNDLED WITH
+ 1.11.2
diff --git a/app/models/place.rb b/app/models/place.rb
index 1b42391..1738374 100644
--- a/app/models/place.rb
+++ b/app/models/place.rb
@@ -3,10 +3,10 @@ class Place < ActiveRecord::Base
has_many :comments
has_many :photos
- geocoded_by :address
- after_validation :geocode
+ # geocoded_by :address
+ # after_validation :geocode
validates :name, presence: true, length: { minimum: 3 }
validates :address, presence: true
validates :description, presence: true
-end
\ No newline at end of file
+end
diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb
index 510b3f2..de6dc1a 100644
--- a/app/uploaders/picture_uploader.rb
+++ b/app/uploaders/picture_uploader.rb
@@ -3,12 +3,12 @@
class PictureUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
- # include CarrierWave::RMagick
+ include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
- #storage :file
- storage :fog
+ storage :file
+ # storage :fog
# Override the directory where uploaded files will be stored.
@@ -17,6 +17,14 @@ class PictureUploader < CarrierWave::Uploader::Base
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
+ process :do_auto_orient
+
+ def do_auto_orient
+ manipulate! do |img|
+ img.auto_orient
+ end
+ end
+
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
diff --git a/config/database.yml b/config/database.yml
index d128da4..207eaa5 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -17,11 +17,8 @@
development:
adapter: postgresql
encoding: unicode
- database: nomster_development
+ database: nomster_development_jen
pool: 5
- username: postgres
- password: password
- host: localhost
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
@@ -47,17 +44,11 @@ development:
test:
adapter: postgresql
encoding: unicode
- database: nomster_test
+ database: nomster_test_jen
pool: 5
- username: postgres
- password: password
- host: localhost
production:
adapter: postgresql
encoding: unicode
- database: nomster_production
+ database: nomster_production_jen
pool: 5
- username: postgres
- password: password
- host: localhost
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb
index eee5de5..da40c98 100644
--- a/config/initializers/carrierwave.rb
+++ b/config/initializers/carrierwave.rb
@@ -1,10 +1,10 @@
# config/initializers/carrierwave.rb
CarrierWave.configure do |config|
- config.fog_credentials = {
- :provider => 'AWS', # required
- :aws_access_key_id => ENV["AWS_ACCESS_KEY"], # required
- :aws_secret_access_key => ENV["AWS_SECRET_KEY"] # required
- }
- config.fog_directory = ENV["AWS_BUCKET"] # required
-end
\ No newline at end of file
+ # config.fog_credentials = {
+ # :provider => 'AWS', # required
+ # :aws_access_key_id => ENV["AWS_ACCESS_KEY"], # required
+ # :aws_secret_access_key => ENV["AWS_SECRET_KEY"] # required
+ # }
+ # config.fog_directory = ENV["AWS_BUCKET"] # required
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment