CRUD data entry of a foreign key

I can change the foreign key for a row in the “calls” table through the
console, but want to be able to assign a different login_id to a
specific
“calls” record.

This is done through the controller and the view?

[email protected] ~/goodfellow-tool $
[email protected] ~/goodfellow-tool $ script/console
Loading development environment.

c=Call.find_by_id(1)
=> #<Call:0xb6fc9070 @attributes={“id”=>“1”, “comment”=>“first”,
“login_id”=>“1”, “created_at”=>“2008-02-08 13:37:29”}>

?> l=Login.find_by_id(2)
=> #<Login:0xb6fb8fb8 @attributes={“id”=>“2”, “employee_id”=>“1”,
“login”=>“1234”}>

?> c.update_attribute :login_id, 2
=> true

?> c
=> #<Call:0xb6fc9070 @attributes={“id”=>“1”, “comment”=>“first”,
“login_id”=>2, “created_at”=>“2008-02-08 13:37:29”}>

?> quit
[email protected] ~/goodfellow-tool $

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs