Paper clip plugin validation fails

hallo friends i developpeda photo uploader using paper clip plugin
its working quite well , but one problem is its able to upload all
kinds of file. see i want only png,gif,jpeg and should show error
message if validation fails.here if i applied validations in the model
the result is errors like this

ArgumentError (too few arguments):
app/controllers/images_controller.rb:63:in format' app/controllers/images_controller.rb:63:increate’
vendor/plugins/haml/rails/./lib/sass/plugin/rails.rb:19:in process' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:162:in start' /usr/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/lib/ruby/1.8/webrick/server.rb:92:ineach’
/usr/lib/ruby/1.8/webrick/server.rb:92:in start' /usr/lib/ruby/1.8/webrick/server.rb:23:instart’
/usr/lib/ruby/1.8/webrick/server.rb:82:in start' -e:4:inload’
-e:4
here are my controller code

def create

@user = @current_user.id
puts"usertrrrr"[email protected]
@image = Image.new(params[:image].merge(:user_id => @user))
  if @image.save_with_permissions(params[:users])

     puts"if saved"

  else
      puts"if not saved"
     format.js   # create.js.rjs
     format.xml  { render :xml => @image.errors, :status =>

:unprocessable_entity }
puts"hiiiiiiiiiiiiiiiiii"[email protected]

  end
  #puts"check  the  srrors are"[email protected]
 responds_to_parent { render }

end

here is the model validation

validates_attachment_content_type :picture,
:content_type=>[‘image/jpeg’, ‘image/png’, ‘image/gif’], :message =>
:missing_content_type

                   or

validates_format_of :picture,:allow_blank=>true, :with =>
%r{.(gif|jpg|png|jpeg|bmp)$}i,:message => “Invalid file extension for
teaser image. Please upload files with the following extensions only :
.jpg, .jpeg, .png, .gif, .bmp”

can anyone help me to sort out this issue.please help me

Thanks In advance

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs