Hi,
I seem to have a fundamental misunderstaning or Rake, Ruby, or
Migrations.(or perhaps all three)
I have done dozens of simple Migrations with just a self.up and
self.down... Now I have one that is more complex and I want to call
other methods within the migration.. but it doesn''t work...
Here is my self.up:
def self.up
drop_old_tables
create_tables
populate_questions
populate_forms
end
here is the error message:
undefined method `drop_old_tables'' for
#<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x499deb0>
I have a drop_old_tables method defined lower down.
Thanks in anticipation for any help
Giorgio
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I figured it out myself! All the methods must be class methods as there is no instance I suppose. ie self.drop_old_tables etc. Cheers Giorgio giorgio wrote:> Hi, > > I seem to have a fundamental misunderstaning or Rake, Ruby, or > Migrations.(or perhaps all three) > > I have done dozens of simple Migrations with just a self.up and > self.down... Now I have one that is more complex and I want to call > other methods within the migration.. but it doesn''t work... > Here is my self.up: > def self.up > drop_old_tables > create_tables > populate_questions > populate_forms > end > > here is the error message: > undefined method `drop_old_tables'' for > #<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x499deb0> > > I have a drop_old_tables method defined lower down. > > Thanks in anticipation for any help > > Giorgio--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Make sure the other methods are defined on the same class and as class methods with "def self.x" Michael giorgio wrote:> Hi, > > I seem to have a fundamental misunderstaning or Rake, Ruby, or > Migrations.(or perhaps all three) > > I have done dozens of simple Migrations with just a self.up and > self.down... Now I have one that is more complex and I want to call > other methods within the migration.. but it doesn''t work... > Here is my self.up: > def self.up > drop_old_tables > create_tables > populate_questions > populate_forms > end > > here is the error message: > undefined method `drop_old_tables'' for > #<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x499deb0> > > I have a drop_old_tables method defined lower down. > > Thanks in anticipation for any help > > Giorgio--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---