Problem with paperclip

hello,

i am trying to upload a image file …using paperclip in rails 3
i did as follows

  1. In gemfile => included gem paperclip

2.In config/environments /development.rb =>
Paperclip.options[:command_path]
= “/usr/bin/” (convert path)

3.created a controller *picusers *and defined => def create
@picuser = Picuser.create(params[:picuser])
end

4.created a model picuser with =>has_attached_file :avatar, :styles
=>
{:medium => "300
300>", :thumb => "100
100>" }
created a migration file with following columns => class
AddAvatarColumnsToPicusers < ActiveRecord::Migration

def self.up

add_column :picusers, :avatar_file_name, :string

 add_column :picusers, :avatar_content_type, :string

add_column :picusers, :avatar_file_size, :integer

add_column :picusers, :avatar_updated_at, :datetime

end
def
self.down

remove_column :picusers, :avatar_file_name

remove_column :picusers, :avatar_content_type

remove_column :picusers, :avatar_file_size

remove_column :picusers, :avatar_updated_at
end
end

  1. created a view with picuser => show.html.erb
    <%= image_tag
    @picuser.avatar.url %>
    <%= image_tag
    @picuser.avatar.url(:medium) %>
    <%= image_tag
    @picuser.avatar.url(:thumb) %>

                                 => edit.html.erb
                                       <% form_for :picuser, 
    

@picuser,
:url => picuser_path, :html => { :multipart => true } do |form| %>
<%= form.file_field :avatar %>
<% end %>
=> new.html.erb
<% form_for :picuser, @picuser,
:url =>
picuser_path(current_picuser.id), :html => { :multipart => true } do
|form|
%>
<%= form.file_field :avatar %>
<% end %>

*GETTING ERROR AS NO ROUTE MATCHES :SHOW CONTROLLER:PICUSERS EVEN AFTER
SETTING ROUTES.RB
PLEASE COULDANYONE THERE HELP
*

try “rake routes” in your console and see if there is anything like:
user
{:action => ‘show’, :controller => ‘pictures’}

Here you don’t have any issue with paperclip it seems!! its some routing
issue which is messing things up!

On Sun, Aug 7, 2011 at 7:10 PM, Annapoorna R [email protected]
wrote:

@picuser = Picuser.create(params[:picuser])

remove_column :picusers, :avatar_file_name
5. created a view with picuser => show.html.erb
<%= form.file_field :avatar %>
SETTING ROUTES.RB
http://groups.google.com/group/rubyonrails-talk?hl=en.

Please consider the environment before printing this email.

Regards,
Surya

Hi,
You declared method show in picusers controller. And check the
routes by giving rake routes in your project path. One more thing, if u
changed anything in routes file, don’t forget to restart the server.

Thanks,
Manivannan.S

On Mon, Aug 8, 2011 at 11:12 AM, Surya [email protected] wrote:

remove_column :picusers, :avatar_content_type
@picuser.avatar.url %>
=> new.html.erb
*

You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Regards,
Manivannan.S