I have a model columns, and here''s the table data:
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.column :title, :string, :limit => 100
t.column :comment, :text
t.column :meeting_id, :integer
t.column :user_id, :integer
t.column :posted_at, :datetime
t.column :comment_id, :integer
end
end
def self.down
drop_table :comments
end
end
Then, I did script/generate scaffold comment comment
It created all the files. However, when I try to "create new" it
throws an error:
http://rafb.net/paste/results/zaAxQb54.html
I''m totally bewildered. What could be causing this error? There are
no validations in the model.
Thanks,
Ben Lisbakken
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Does this do the trick if you modify your class definition as follows:
class Comment < ActiveRecord::Base
set_table_name "comments"
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
naw =/ it doesn''t -Ben --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Tue, 2006-09-12 at 23:01 +0000, Ben Lisbakken wrote:> I have a model columns, and here''s the table data: > > class CreateComments < ActiveRecord::Migration > def self.up > create_table :comments do |t| > t.column :title, :string, :limit => 100 > t.column :comment, :text > t.column :meeting_id, :integer > t.column :user_id, :integer > t.column :posted_at, :datetime > t.column :comment_id, :integer > end > end > > def self.down > drop_table :comments > end > end > > > Then, I did script/generate scaffold comment comment > > It created all the files. However, when I try to "create new" it > throws an error: > http://rafb.net/paste/results/zaAxQb54.html > > I''m totally bewildered. What could be causing this error? There are > no validations in the model.---- You probably should have done it like... script/generate scaffold Comment you might want to script/destroy model comment script/destroy controller comment and try again Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Craig - Thanks for letting me know about the script/destroy! I didn''t know about that hehe. What you said didn''t work, but I think it all had to do with my sql. I did rake db:migrate VERSION=0 then did rake db:migrate, then regenerated the scaffold and it worked. Thanks for the help, it''s much appreciated! -Ben --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---