Hi Ken!
If I understand very well your problem! the database is not
recognizing this collumm. By want i saw the collum was created . but
we would have to analize the SQL command in complete. Just a shot!
Maybe in your sql command you are join two tables or more and if is
true you most to specify the origin of the field. Like this:
SELECT T01.FIELD01 , T02.FIELD01
FROM TABLE01 T01 , TABLE02 T02
WHERE T01.FIELD01 = T02.FIELD01
I hope i helped you !
Post the sql command in complete.
Tony Bacellar
tonybacellar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
delicious.com/tonybacellar
Ken Lim wrote:> Had this error when trying to add comments to another user''s
photo.
>
> ActiveRecord::StatementInvalid in User photosController#show
> Mysql::Error: Unknown column ''comments.user_id'' in
''on clause'': SELECT
> photos.`id` AS t0_r0, photos.`user_id` AS t0_r1, photos.`title` AS
> t0_r2, photos.`body` AS t0_r3, photos.`created_at` AS t0....
>
> I did create a user_id column in the comments as such:
>
> class CreateComments < ActiveRecord::Migration
> def self.up
> create_table :comments do |t|
> t.column :photo_id, :integer
> t.column :user_id, :integer
> t.column :guest_name, :string
> t.column :guest_email, :string
> t.column :guest_url, :string
> t.column :body, :text
> t.column :created_at, :datetime
> end
> add_index :comments, :photo_id
> end
>
> def self.down
> drop_table :comments
> end
> end
>
> Can anyone tell me what went wrong and how to solve?
> --
> Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---