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
5. 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
*
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
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
<prapoorna.r-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 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
>
>
> 5. 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
> *
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
--
Please consider the environment before printing this email.
Regards,
Surya
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
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
<raj.surya19-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 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
<prapoorna.r-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:
>
>> 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
>>
>>
>> 5. 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
>> *
>>
>> --
>> You received this message because you are subscribed to the Google
Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To unsubscribe from this group, send email to
>>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> --
>
> Please consider the environment before printing this email.
>
> Regards,
> Surya
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
--
Regards,
Manivannan.S
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.