Hello people,
I installed paperclip gem with these following lines in gem file
gem ''rmagick''
gem "paperclip", "~> 2.0"
gem ''aws-s3''
I am using amazon S3.
the problem came when I ran the migration which had the following
migration code
class AddImageColumnsToPicture < ActiveRecord::Migration
def self.up
change_table :pictures do |t|
t.has_attached_file :image
end
end
def self.down
drop_attached_file :pictures, :image
end
end
It gave the following error:
An error has occurred, this and all later migrations canceled:
undefined method `has_attached_file'' for
#<ActiveRecord::ConnectionAdapters::Table:0xb414d98>
Any one knows how to fix it?
--
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.
On Jan 13, 2012, at 4:44 AM, Karthikeyan wrote:> Hello people, > > I installed paperclip gem with these following lines in gem file > > gem ''rmagick'' > gem "paperclip", "~> 2.0" > gem ''aws-s3'' > > I am using amazon S3. > > the problem came when I ran the migration which had the following > migration code > > class AddImageColumnsToPicture < ActiveRecord::Migration > def self.up > change_table :pictures do |t| > t.has_attached_file :image > end > end > > def self.down > drop_attached_file :pictures, :image > end > end > > It gave the following error: > > An error has occurred, this and all later migrations canceled: > > undefined method `has_attached_file'' for > #<ActiveRecord::ConnectionAdapters::Table:0xb414d98> > > Any one knows how to fix it?See if updating to the newest gem fixes it. (2.4.5 at the moment). I don''t recall seeing that helpful migration method the last time I used Paperclip, so it may be newer than your gem. Walter -- 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.
did you add the definitions and functions to your model file? jordan On Jan 13, 2012, at 9:27 AM, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> > On Jan 13, 2012, at 4:44 AM, Karthikeyan wrote: > >> Hello people, >> >> I installed paperclip gem with these following lines in gem file >> >> gem ''rmagick'' >> gem "paperclip", "~> 2.0" >> gem ''aws-s3'' >> >> I am using amazon S3. >> >> the problem came when I ran the migration which had the following >> migration code >> >> class AddImageColumnsToPicture < ActiveRecord::Migration >> def self.up >> change_table :pictures do |t| >> t.has_attached_file :image >> end >> end >> >> def self.down >> drop_attached_file :pictures, :image >> end >> end >> >> It gave the following error: >> >> An error has occurred, this and all later migrations canceled: >> >> undefined method `has_attached_file'' for >> #<ActiveRecord::ConnectionAdapters::Table:0xb414d98> >> >> Any one knows how to fix it? > > See if updating to the newest gem fixes it. (2.4.5 at the moment). I don''t recall seeing that helpful migration method the last time I used Paperclip, so it may be newer than your gem. > > Walter > > -- > 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. >-- 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.
Hello Jordan,
I am not quiet sure. This is how my model looks like
class Picture < ActiveRecord::Base
has_attached_file :image,
:styles => { :medium => "300x300>", :thumb =>
"100x100>" },
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/s3.yml",
:path => ":class/:id/:style/:filename"
end
What should I add to it? I think the problem is in migration.
On Jan 13, 7:58 pm, Jordan Miller
<jrdn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> did you add the definitions and functions to your model file?
>
> jordan
>
> On Jan 13, 2012, at 9:27 AM, Walter Lee Davis
<wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:
>
>
>
>
>
>
>
>
>
> > On Jan 13, 2012, at 4:44 AM, Karthikeyan wrote:
>
> >> Hello people,
>
> >> I installed paperclip gem with these following lines in gem file
>
> >> gem ''rmagick''
> >> gem "paperclip", "~> 2.0"
> >> gem ''aws-s3''
>
> >> I am using amazon S3.
>
> >> the problem came when I ran the migration which had the following
> >> migration code
>
> >> class AddImageColumnsToPicture < ActiveRecord::Migration
> >> def self.up
> >> change_table :pictures do |t|
> >> t.has_attached_file :image
> >> end
> >> end
>
> >> def self.down
> >> drop_attached_file :pictures, :image
> >> end
> >> end
>
> >> It gave the following error:
>
> >> An error has occurred, this and all later migrations canceled:
>
> >> undefined method `has_attached_file'' for
> >> #<ActiveRecord::ConnectionAdapters::Table:0xb414d98>
>
> >> Any one knows how to fix it?
>
> > See if updating to the newest gem fixes it. (2.4.5 at the moment). I
don''t recall seeing that helpful migration method the last time I used
Paperclip, so it may be newer than your gem.
>
> > Walter
>
> > --
> > 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
athttp://groups.google.com/group/rubyonrails-talk?hl=en.
--
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@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
I fixed it using old ways, changed migration file as shown class AddImageColumnsToPicture < ActiveRecord::Migration def self.up add_column :pictures, :image_file_name, :string add_column :pictures, :image_content_type, :string add_column :pictures, :image_file_size, :integer add_column :pictures, :image_updated_at, :datetime end def self.down remove_column :pictures, :image_file_name remove_column :pictures, :image_content_type remove_column :pictures, :image_file_size remove_column :pictures, :image_updated_at end end It looks bulky, but works. i must upgrade to newest gem and see if the short version works. On Jan 13, 7:26 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> On Jan 13, 2012, at 4:44 AM, Karthikeyan wrote: > > > > > > > > > > > Hello people, > > > I installed paperclip gem with these following lines in gem file > > > gem ''rmagick'' > > gem "paperclip", "~> 2.0" > > gem ''aws-s3'' > > > I am using amazon S3. > > > the problem came when I ran the migration which had the following > > migration code > > > class AddImageColumnsToPicture < ActiveRecord::Migration > > def self.up > > change_table :pictures do |t| > > t.has_attached_file :image > > end > > end > > > def self.down > > drop_attached_file :pictures, :image > > end > > end > > > It gave the following error: > > > An error has occurred, this and all later migrations canceled: > > > undefined method `has_attached_file'' for > > #<ActiveRecord::ConnectionAdapters::Table:0xb414d98> > > > Any one knows how to fix it? > > See if updating to the newest gem fixes it. (2.4.5 at the moment). I don''t recall seeing that helpful migration method the last time I used Paperclip, so it may be newer than your gem. > > Walter-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.