I''m having some troubles running what should be a simple migration yet I''m getting the error: rake aborted! wrong number of arguments (1 for 0) Here is my migration (the up() method): # initial permissions Permission.create :name => ''NEWS_VIEW'' Permission.create :name => ''NEWS_CREATE'' Permission.create :name => ''NEWS_EDIT'' Permission.create :name => ''NEWS_DELETE'' Permission.create :name => ''NEWS_CATEGORY_CREATE'' Permission.create :name => ''NEWS_CATEGORY_EDIT'' Permission.create :name => ''NEWS_CATEGORY_DELETE'' Permission.create :name => ''NEWS_POST_COMMENT'' Permission.create :name => ''NEWS_DELETE_COMMENT'' Permission.create :name => ''KB_VIEW'' Permission.create :name => ''KB_CATEGORY_CREATE'' Permission.create :name => ''KB_CATEGORY_EDIT'' Permission.create :name => ''KB_CATEGORY_DELETE'' Permission.create :name => ''KB_ARTICLE_CREATE'' Permission.create :name => ''KB_ARTICLE_EDIT'' Permission.create :name => ''KB_ARTICLE_DELETE'' # administrator role admin_role = Role.create :name => ''Administrator'', :description => ''Top level role with full permissions'' Permission.find(:all).each do |p| admin_role.permissions << p end # create root user root_user = User.create( :first_name => ''Root'', :surname => ''User'', :short_name => ''Root'', :username => ''rootuser'', :password => ''rootpass'', :email_address => ''root-XxWxGjljJKY@public.gmane.org'' ) root_user.roles << admin_role root_user.save The line its falling over on is the root_user = User.create method. I don''t think its because of the way I''ve laid it out over several lines - I''ve tried it with and without the parentheses and all on one line as well. I''ve also tried just setting one or two of the fields. Here is my schema definition for the user table: create_table "users", :force => true do |t| t.column "surname", :string, :limit => 100 t.column "first_name", :string, :limit => 100 t.column "short_name", :string, :limit => 30 t.column "username", :string, :limit => 30 t.column "password", :string, :limit => 40 t.column "email_address", :string end add_index "users", ["id"], :name => "id", :unique => true And here is a backtrace: /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:465:in `initialize'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:465:in `create'' ./db/migrate//002_initial_user_data.rb:29:in `up'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/migration.rb:211:in `migrate'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/migration.rb:206:in `each'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/migration.rb:206:in `migrate'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/migration.rb:173:in `up'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/migration.rb:164:in `migrate'' /usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/tasks/databases.rake:3 /usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/tasks/databases.rake:2:in `call'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `execute'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `each'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `execute'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:180:in `invoke'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `each'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/bin/rake:7 /usr/bin/rake:18 Help! I''m stumped. Cheers Luke _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I''m having some troubles running what should be a simple migration yet I''m getting the error: rake aborted! wrong number of arguments (1 for 0) Here is my migration (the up() method): # initial permissions Permission.create :name => ''NEWS_VIEW'' Permission.create :name => ''NEWS_CREATE'' Permission.create :name => ''NEWS_EDIT'' Permission.create :name => ''NEWS_DELETE'' Permission.create :name => ''NEWS_CATEGORY_CREATE'' Permission.create :name => ''NEWS_CATEGORY_EDIT'' Permission.create :name => ''NEWS_CATEGORY_DELETE'' Permission.create :name => ''NEWS_POST_COMMENT'' Permission.create :name => ''NEWS_DELETE_COMMENT'' Permission.create :name => ''KB_VIEW'' Permission.create :name => ''KB_CATEGORY_CREATE'' Permission.create :name => ''KB_CATEGORY_EDIT'' Permission.create :name => ''KB_CATEGORY_DELETE'' Permission.create :name => ''KB_ARTICLE_CREATE'' Permission.create :name => ''KB_ARTICLE_EDIT'' Permission.create :name => ''KB_ARTICLE_DELETE'' # administrator role admin_role = Role.create :name => ''Administrator'', :description => ''Top level role with full permissions'' Permission.find(:all).each do |p| admin_role.permissions << p end # create root user root_user = User.create( :first_name => ''Root'', :surname => ''User'', :short_name => ''Root'', :username => ''rootuser'', :password => ''rootpass'', :email_address => '' root-XxWxGjljJKY@public.gmane.org'' ) root_user.roles << admin_role root_user.save The line its falling over on is the root_user = User.create method. I don''t think its because of the way I''ve laid it out over several lines - I''ve tried it with and without the parentheses and all on one line as well. I''ve also tried just setting one or two of the fields. Here is my schema definition for the user table: create_table "users", :force => true do |t| t.column "surname", :string, :limit => 100 t.column "first_name", :string, :limit => 100 t.column "short_name", :string, :limit => 30 t.column "username", :string, :limit => 30 t.column "password", :string, :limit => 40 t.column "email_address", :string end add_index "users", ["id"], :name => "id", :unique => true And here is a backtrace: /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:465:in `initialize'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:465:in `create'' ./db/migrate//002_initial_user_data.rb:29:in `up'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/migration.rb:211:in `migrate'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/migration.rb:206:in `each'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/migration.rb:206:in `migrate'' /usr/lib/ruby/gems/1.8/gems/activerecord- 1.13.0/lib/active_record/migration.rb:173:in `up'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/migration.rb:164:in `migrate'' /usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/tasks/databases.rake:3 /usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/tasks/databases.rake:2:in `call'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `execute'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `each'' /usr/lib/ruby/gems/1.8/gems/rake- 0.6.2/lib/rake.rb:202:in `execute'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:180:in `invoke'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `each'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run'' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/bin/rake:7 /usr/bin/rake:18 Help! I''m stumped. Cheers Luke _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
What does your User model look like? Have you defined an initialize method for it? (That''s kind of what it looks like, from the backtrace anyway). If so, please note that the initialize method is special for ActiveRecord, and you should use the after_find/after_initialize hooks to do on-creation initialization, rather than overriding the initialize method. - Jamis On Nov 10, 2005, at 8:10 AM, Luke Redpath wrote:> I''m having some troubles running what should be a simple migration > yet I''m getting the error: > > rake aborted! > wrong number of arguments (1 for 0) > > Here is my migration (the up() method): > > # initial permissions > Permission.create :name => ''NEWS_VIEW'' > Permission.create :name => ''NEWS_CREATE'' > Permission.create :name => ''NEWS_EDIT'' > Permission.create :name => ''NEWS_DELETE'' > Permission.create :name => ''NEWS_CATEGORY_CREATE'' > Permission.create :name => ''NEWS_CATEGORY_EDIT'' > Permission.create :name => ''NEWS_CATEGORY_DELETE'' > Permission.create :name => ''NEWS_POST_COMMENT'' > Permission.create :name => ''NEWS_DELETE_COMMENT'' > Permission.create :name => ''KB_VIEW'' > Permission.create :name => ''KB_CATEGORY_CREATE'' > Permission.create :name => ''KB_CATEGORY_EDIT'' > Permission.create :name => ''KB_CATEGORY_DELETE'' > Permission.create :name => ''KB_ARTICLE_CREATE'' > Permission.create :name => ''KB_ARTICLE_EDIT'' > Permission.create :name => ''KB_ARTICLE_DELETE'' > > # administrator role > admin_role = Role.create :name => ''Administrator'', :description > => ''Top level role with full permissions'' > Permission.find(:all).each do |p| > admin_role.permissions << p > end > > # create root user > root_user = User.create( > :first_name => ''Root'', > :surname => ''User'', > :short_name => ''Root'', > :username => ''rootuser'', > :password => ''rootpass'', > :email_address => '' root-XxWxGjljJKY@public.gmane.org'' > ) > root_user.roles << admin_role > root_user.save > > The line its falling over on is the root_user = User.create method. > I don''t think its because of the way I''ve laid it out over several > lines - I''ve tried it with and without the parentheses and all on > one line as well. I''ve also tried just setting one or two of the > fields. > > Here is my schema definition for the user table: > > create_table "users", :force => true do |t| > t.column "surname", :string, :limit => 100 > t.column "first_name", :string, :limit => 100 > t.column "short_name", :string, :limit => 30 > t.column "username", :string, :limit => 30 > t.column "password", :string, :limit => 40 > t.column "email_address", :string > end > add_index "users", ["id"], :name => "id", :unique => true > > And here is a backtrace: > > /usr/lib/ruby/gems/1.8/gems > /activerecord-1.13.0/lib/active_record/base.rb:465:in `initialize'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > base.rb:465:in `create'' > ./db/migrate//002_initial_user_data.rb:29:in `up'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > migration.rb:211:in `migrate'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > migration.rb:206:in `each'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > migration.rb:206:in `migrate'' > /usr/lib/ruby/gems/1.8/gems/activerecord- 1.13.0/lib/active_record/ > migration.rb:173:in `up'' > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > migration.rb:164:in `migrate'' > /usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/tasks/databases.rake:3 > /usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/tasks/databases.rake: > 2:in `call'' > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `execute'' > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `each'' > /usr/lib/ruby/gems/1.8/gems/rake- 0.6.2/lib/rake.rb:202:in `execute'' > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:180:in `invoke'' > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run'' > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `each'' > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run'' > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/bin/rake:7 > /usr/bin/rake:18 > > Help! I''m stumped. > > Cheers > Luke > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Ah! Thanks Jamis, yes, I did have an initialize method. I will change this. Cheers Luke On 11/10/05, Jamis Buck <jamis-uHoyYlH2B+GakBO8gow8eQ@public.gmane.org> wrote:> > What does your User model look like? Have you defined an initialize > method for it? (That''s kind of what it looks like, from the backtrace > anyway). If so, please note that the initialize method is special for > ActiveRecord, and you should use the after_find/after_initialize > hooks to do on-creation initialization, rather than overriding the > initialize method. > > - Jamis > > On Nov 10, 2005, at 8:10 AM, Luke Redpath wrote: > > > I''m having some troubles running what should be a simple migration > > yet I''m getting the error: > > > > rake aborted! > > wrong number of arguments (1 for 0) > > > > Here is my migration (the up() method): > > > > # initial permissions > > Permission.create :name => ''NEWS_VIEW'' > > Permission.create :name => ''NEWS_CREATE'' > > Permission.create :name => ''NEWS_EDIT'' > > Permission.create :name => ''NEWS_DELETE'' > > Permission.create :name => ''NEWS_CATEGORY_CREATE'' > > Permission.create :name => ''NEWS_CATEGORY_EDIT'' > > Permission.create :name => ''NEWS_CATEGORY_DELETE'' > > Permission.create :name => ''NEWS_POST_COMMENT'' > > Permission.create :name => ''NEWS_DELETE_COMMENT'' > > Permission.create :name => ''KB_VIEW'' > > Permission.create :name => ''KB_CATEGORY_CREATE'' > > Permission.create :name => ''KB_CATEGORY_EDIT'' > > Permission.create :name => ''KB_CATEGORY_DELETE'' > > Permission.create :name => ''KB_ARTICLE_CREATE'' > > Permission.create :name => ''KB_ARTICLE_EDIT'' > > Permission.create :name => ''KB_ARTICLE_DELETE'' > > > > # administrator role > > admin_role = Role.create :name => ''Administrator'', :description > > => ''Top level role with full permissions'' > > Permission.find(:all).each do |p| > > admin_role.permissions << p > > end > > > > # create root user > > root_user = User.create( > > :first_name => ''Root'', > > :surname => ''User'', > > :short_name => ''Root'', > > :username => ''rootuser'', > > :password => ''rootpass'', > > :email_address => '' root-XxWxGjljJKY@public.gmane.org'' > > ) > > root_user.roles << admin_role > > root_user.save > > > > The line its falling over on is the root_user = User.create method. > > I don''t think its because of the way I''ve laid it out over several > > lines - I''ve tried it with and without the parentheses and all on > > one line as well. I''ve also tried just setting one or two of the > > fields. > > > > Here is my schema definition for the user table: > > > > create_table "users", :force => true do |t| > > t.column "surname", :string, :limit => 100 > > t.column "first_name", :string, :limit => 100 > > t.column "short_name", :string, :limit => 30 > > t.column "username", :string, :limit => 30 > > t.column "password", :string, :limit => 40 > > t.column "email_address", :string > > end > > add_index "users", ["id"], :name => "id", :unique => true > > > > And here is a backtrace: > > > > /usr/lib/ruby/gems/1.8/gems > > /activerecord-1.13.0/lib/active_record/base.rb:465:in `initialize'' > > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > > base.rb:465:in `create'' > > ./db/migrate//002_initial_user_data.rb:29:in `up'' > > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > > migration.rb:211:in `migrate'' > > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > > migration.rb:206:in `each'' > > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > > migration.rb:206:in `migrate'' > > /usr/lib/ruby/gems/1.8/gems/activerecord- 1.13.0/lib/active_record/ > > migration.rb:173:in `up'' > > /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ > > migration.rb:164:in `migrate'' > > /usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/tasks/databases.rake:3 > > /usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/tasks/databases.rake: > > 2:in `call'' > > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `execute'' > > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `each'' > > /usr/lib/ruby/gems/1.8/gems/rake- 0.6.2/lib/rake.rb:202:in `execute'' > > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:180:in `invoke'' > > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run'' > > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `each'' > > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run'' > > /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/bin/rake:7 > > /usr/bin/rake:18 > > > > Help! I''m stumped. > > > > Cheers > > Luke > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi, I was wondering if anyone has any experience with livetree, or knows where to find people that do. thanks -Chris
sorry about the subject the first time.... Chris Roeder wrote:> Hi, > > I was wondering if anyone has any experience with livetree, or knows > where to find people that do. > > thanks > -Chris > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails