ive running a ror 3 + 1.87 app with 2 models. In one of them i want to
have a start value of a string-object (f.e. "User".Object is default
named to "Ray"), which should be saved as ID 1. That means if i would
set up the database, then i automatically got that Object User with
value "Ray" and ID 1. So how can i realize this?
Note that it is not a good idea to rely on the id of a record having a
particular value (1 in this case). If you want a field containing a
meaningful number then add another field to contain that number.
Note that it is not a good idea to rely on the id of a record having a
particular value (1 in this case). If you want a field containing a
meaningful number then add another field to contain that number.
Colin
Ok, but my idea behind is that i only use this one value. Then i have
the option to edit/update it, so there's always one value according to
ID 1. No create/delete options available.
Well asides that, i have another problem. I want to associate 2 models:
country and events (with country has many events and event belongs to
country). I use both in the countries_controller, but i dont know how to
create objects in events thorugh this controller. You got any
suggestions?
Note that it is not a good idea to rely on the id of a record having a
particular value (1 in this case). If you want a field containing a
meaningful number then add another field to contain that number.
Colin
Ok, but my idea behind is that i only use this one value. Then i have
the option to edit/update it, so there's always one value according to
ID 1. No create/delete options available.
Then that's a bad idea. Colin is absolutely right: no particular ID
value should ever, ever, ever be meaningful.
Well asides that, i have another problem. I want to associate 2 models:
country and events (with country has many events and event belongs to
country). I use both in the countries_controller, but i dont know how to
create objects in events thorugh this controller. You got any
suggestions?