changing model
Added by Zdravko Balorda about 11 years ago
I'm writing my own plugin for redmine and I've just started with the tutorial.
ruby script/rails generate redmine_plugin_model <plugin_name> <model_name> ...
created a table, how to add a field to a table? I am also new to ruby, to make things worse.
Regards, Zdravko
ps. I can add a field by:
rails generate migration add_birth_to_pacients birth:date
but the migration ends in core db/migrate directory, not in plugin's db/migrate
Replies (1)
RE: changing model - Added by Martin Denizet (redmine.org team member) almost 11 years ago
To generate a model with the plugin model generator, you have to add the fields after the model name. Example:
ruby script/rails redmine_plugin_model redmine_clients Client name:string code:string:index born_on:date friendly:boolean family_size:integer
You can actually modify yourself the migration files created by the generator. You can even create migration files manually. See: http://guides.rubyonrails.org/migrations.html
Be aware that you may have to modify the generated tests if you to that.