PLease provide more code to get help. Thanks. I don’t understand why do
you need add a another user to post. If you want this, then the
association is has_and_belongs_to_many or has_many :through between the
model users and posts.
PLease provide more code to get help. Thanks. I don’t understand why do
you need add a another user to post. If you want this, then the
association is has_and_belongs_to_many or has_many :through between the
model users and posts.
Sorry, what I mean is that I’d like to change which user the post
belongs to, not add other ones. Here’s more code:
class User < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :user
end
in the db schema:
create_table “posts”, :force => true do |t|
t.column “user_id”, :integer
end