Hi guys,
I'm creating my forms without the scaffold script, and now, I
needed to add one more column in my table. But how can I update this?
When I type something in this new text field, my database do not
insert this new data.
Thanks,
Osiro
Hi guys,
I'm creating my forms without the scaffold script, and now, I
needed to add one more column in my table. But how can I update this?
When I type something in this new text field, my database do not
insert this new data.
Thanks,
Osiro
Hello,
I’m not totally clear what you mean. Once, you add a field to your
table, you will also need to add a text field for it in your form_tag
or form_for in your view. Can you post the code you’re using in your
view with the form and also the code that performs the action.
Jason Arora
As I understand your question, you need to do migration of the column
like this
script/generate migration AddColumnToTable
in the 0_0_x_add_column_to_table.rb file in db/migrate you need to add
this column using
add_column :table_name, :column_name, :type(string, int, etc)
then you execute
rake db:migrate
do not forget to update your views so they match with the new change
I wish I answered you
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs