Created
March 25, 2012 02:50
-
-
Save andrewhl/2190915 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tr> | |
<td><%= f.label :first_name %></td> | |
<td><%= f.text_field :first_name %></td> | |
<td><%= f.label :last_name %></td> | |
<td><%= f.text_field :last_name %></td> | |
</tr> | |
<tr> | |
<td><%= f.label :health_card %></td> | |
<td><%= f.text_field :health_card %></td> | |
<td><%= f.label :medical %></td> | |
<td><%= f.text_field :medical %></td> | |
</tr> | |
<tr> | |
<td><%= f.label :grade %></td> | |
<td><%= f.text_field :grade %></td> | |
<td><%= f.label :class %></td> | |
<td><%= f.text_field :class %></td> | |
</tr> | |
<tr> | |
<td><%= f.label :campus %></td> | |
<td><%= f.text_field :campus %></td> | |
<td></td> | |
<td></td> | |
</tr> | |
<tr> | |
<td><%= f.label :emergency_first_name %></td> | |
<td><%= f.text_field :emergency_first_name %></td> | |
<td><%= f.label :emergency_last_name %></td> | |
<td><%= f.text_field :emergency_last_name %></td> | |
</tr> | |
<tr> | |
<td><%= f.label :emergency_phone %></td> | |
<td><%= f.text_field :emergency_phone %></td> | |
<td><%= f.label :shoe_size %></td> | |
<td><%= f.text_field :shoe_size %></td> | |
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Child < ActiveRecord::Base | |
belongs_to :user | |
attr_accessible :first_name, | |
:last_name, | |
:health_card, | |
:medical, | |
:grade, | |
:class, | |
:campus, | |
:emergency_first_name, | |
:emergency_last_name, | |
:emergency_phone, | |
:shoe_size | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChildrenController < ApplicationController | |
def new | |
@child = Child.new | |
end | |
def create | |
@child = Child.new(params[:child]) | |
if @child.save | |
flash[:success] = "Your child was entered into the system successfully." | |
redirect_to new_child_path | |
else | |
render 'new' | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started GET "/children/new" for 127.0.0.1 at 2012-03-24 22:47:09 -0400 | |
Processing by ChildrenController#new as HTML | |
Completed 500 Internal Server Error in 34ms | |
NoMethodError (undefined method `attribute_method_matcher' for nil:NilClass): | |
app/controllers/children_controller.rb:4:in `new' | |
app/controllers/children_controller.rb:4:in `new' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% provide(:title, 'Register children') %> | |
<h2>Register your children</h2> | |
<%= form_for(@child) do |f| %> | |
<table> | |
<%= render 'fields', f: f %> | |
<div class="actions"> | |
<%= f.submit "Register new child" %> | |
</div> | |
<% end %> | |
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Excerpted from schema | |
create_table "children", :force => true do |t| | |
t.string "first_name" | |
t.string "last_name" | |
t.string "health_card" | |
t.string "grade" | |
t.string "class" | |
t.string "campus" | |
t.string "shoe_size" | |
t.string "emergency_first_name" | |
t.string "emergency_last_name" | |
t.string "emergency_phone" | |
t.integer "parent_id" | |
t.text "medical" | |
t.text "pickup_info" | |
t.datetime "created_at", :null => false | |
t.datetime "updated_at", :null => false | |
end |
drewinglis
commented
Jul 2, 2012
via email
That fixed it for me, yes.
…On Mon, Jul 2, 2012 at 1:50 PM, drriley < ***@***.*** > wrote:
Hello I am having this same issue I scaffold and everyting and when I try
to run my New form I get this error. So the solution is just to change the
field class?
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2190915
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment