I'm following a video tutorial to set the Paperclip gem up on my rails project.
So the steps I've taken so far..
- Installed ImageMagick on Terminal - brew install imagemagick
- Installed the Paperclip gem - gem "paperclip", "~> 4.2"
Added the following to my house.rb model file:
has_attached_file :image, styles: { large: "600x600", medium: "300x300", thumb: "150x150#" } validates_attachment_content_type :image, content_type: /\Aimage/.*\Z/
So all in all my house.rb model file now looks like this:
class House < ActiveRecord::Base
validates :title, presence: true
validates :price, presence: true
validates :description, presence: true
validates :image, presence: true
has_attached_file :image, styles: { large: "600x600", medium: "300x300", thumb: "150x150#" }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
end
At which point I need to add a migration using the migration generator, so I type in rails g migration house image and it isn't creating a timestamped database migration file in the folder and the terminal is returning:
Usage:
rails new APP_PATH [options]
and a whole bunch of options. In the tutorial it should return something like:
create db/migrate/20150205123408_add_attachment_image_to_posts.rb
I'm not sure where I'm going wrong here and I'm new to ruby-on-rails so any help would be really appreciated!
bundle install
and are inside your rails project directory? TheUsage: rails new APP_PATH
help only appears when not in a Rails root directory. – Douglas F Shearer