Cameron Diggs
2014-Mar-24 20:50 UTC
Database is not updating after the Active Record Migration.
Hello.
I created a simple database to test adding a column in an active record
migration. Using phpMyAdmin and ROR, this is the code I used for the
migration:
class AddColumns < ActiveRecord::Migration
def self.up
add_column :users, :need_it, :boolean
end
def self.down
remove_column :users, :need_it
end
end
the migration went successfully, as I can see the newly created column in
phpMyAdmin.
The column is, trying to be, mapped to a checkbox, located in the
_form.html.erb file:
<%= form_for(@user) do |f| %>
....
...
...
<div class="field">
<%= f. label :need_it &><br>
<%= f.check_box :need_it %>
</div>
...
<% end %>
But when I enter a new user and select the checkbox, or edit a current
user's checkbox field, the new value doesn't show in the database
(MySQL).
What am I missing?
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/b84fa6c6-4520-47ba-988e-f7bd8ac633cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.