Trying to add an id to my orders database when i run the migration at the command line $ rails generate AddListingIdToOrders listing_id:integer it gives me an error Could not find generator AddListingIdToOrders.
cmd neilpatel$ rails generate AddListingIdToOrders listing_id:integer Could not find generator AddListingIdToOrders.
listing.rb
class Listing < ActiveRecord::Base
if Rails.env.development?
has_attached_file :image, :styles => { :medium => "200x", :thumb => "100x100>" }, :default_url => "photo.jpg"
else
has_attached_file :image, :styles => { :medium => "200x", :thumb => "100x100>" }, :default_url => "photo.jpg",
:storage => :dropbox,
:dropbox_credentials => Rails.root.join("config/dropbox.yml"),
:path => ":style/id_:filename"
end
validates :name, :description, :price, presence: true
validates :price, numericality: { greater_than: 0 }
validates_attachment_presence :image
belongs_to :user
has_many :orders
end
orders.rb
class Order < ActiveRecord::Base validates :address, :city, :state, presence: true
belongs_to :listing
end