I'm presently teaching myself ruby on rails following my degree. I'm really new to the language and want to know more about how migrations work.
[Form the User uses][1]
[Error of Problem][2]
I have updated my existing users table through migration to allow for an additional column 'username' and included some HTML/Ruby to allow the user to enter in the field. I can't fathom how rails generates INSERT SQL statements or updates them upon migration.
Below is my Code for HTML
<%= form_for(user) do |f| %>
<% if user.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% user.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :username %>
<%= f.text_field :username %>
</div>
<div class="field">
<%= f.label :password %>
<%= f.text_field :password %>
</div>
<div class="field">
<%= f.label :email %>
<%= f.text_field :email %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
This is the schema after migration
[Schema after migration (Users)][1]
I must be missing something...
Aucun commentaire:
Enregistrer un commentaire