hello,
i am trying to upload a image file …using paperclip in rails 3
i did as follows
- 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 => "300300>", :thumb => "100100>" }
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
-
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
*