In my application I have a sing_up_page which has a sing_up_form which has a drop_down_list Which shows the role_type.
RoleType is the class in application in which I have stored records
insert into role_type (id,name) values (1,'user');
insert into role_type (id,name) values (1,'admin');
insert into role_type (id,name) values (1,'vender');
manually in database before starting the application. Before moving to the sing_up_page I do
@role_type=RoleType.all
so that drop down can use it to display role_types but I want If their is a procedure to produce these records at the boot time of the application without manually creating records in database as in Groovy on Grails.
If you create a
.rbfile inapp/config/initializers/, it will be executed when the server loads.Example:
app/config/initializers/seed.rbEvery time the server loads, these records will be created.
Question: why are these records not retained in your database? Are you or someone else deleting them?