As far as I can see there is an extra ‘,’ (comma) at the end of the first statement, the statement just before your validates_numericality_of. I have indicated that below within []. Removing that should solve your issue.
class Product < ActiveRecord::Base
validates_presence_of :title, :description, :image_url**[,]**
validates_numericality_of :price
validate :price_must_be_at_least_a_cent
validates_uniqueness_of :title
validates_format_of :image_url,
:with => %r{.(gif|jpg|png$)}i
:message => ‘must be a URL for GIF, JPG’ + 'or
PNG image’
protected
def price_must_be_at_least_a_cent
errors.add(:price, ‘should be at least 0.01’) if price.nil? ||
price < 0.01
end
I know it is difficult when just starting, but I would have thought
that following the previous problem with a comma that you could have
worked out this one yourself. When you see a syntax error the problem
saying something unexpected found that means that there is likely an
error a bit before the point noted. The basic syntax of
validates_format_of (or any function for that matter) is
validates_format_of <parameter>, <parameter>, ... :image_url is the
first parameter, :with => ... is the second and :message => .. is the
third. I am sure you can see the error, or at least the one
generating the message.