Permalink
Browse files

adding phone

  • Loading branch information...
1 parent bf26b62 commit b3a9b9ba937613617d9d6d17fc680454fe988ac1 @superchris superchris committed Nov 1, 2012
@@ -6,9 +6,9 @@
%fieldset
= @textField(field: "first_name", label: "First Name")
= @textField(field: "last_name", label: "Last Name")
+ = @textField(field: "phone", label: "Phone")
= @checkBoxField(field: "evil", label: "Evil")
= @dateField(field: "birth_date", label: "Birth Date", format: "yyyy-mm-dd")
= @selectField(field: "occupation_id", label: "Occupation", collection: @occupations)
.modal-footer
%input{type: "submit", value: "Save", class: "btn btn-primary"}
-
@@ -1,5 +1,9 @@
class Person < ActiveRecord::Base
validates_presence_of :first_name
- validates_format_of :last_name, with: /^J.*/
+ validates_format_of :last_name, with: /^J.*/, message: "Hey you suck!"
+ validates_uniqueness_of :last_name
+ # validates_length_of :phone, minimum: 7, maximum: 10
+ validates_format_of :birth_date, with: /\d+\-\d+\-\d+/, message: "Date must be MM-DD-YYYY", allow_blank: true
belongs_to :occupation
+
end
@@ -0,0 +1,6 @@
+class AddPhoneToPerson < ActiveRecord::Migration
+ def change
+ add_column :people, :phone, :string
+
+ end
+end
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120605190808) do
+ActiveRecord::Schema.define(:version => 20121101135124) do
create_table "occupations", :force => true do |t|
t.string "name"
@@ -27,6 +27,7 @@
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "evil"
+ t.string "phone"
end
end

0 comments on commit b3a9b9b

Please sign in to comment.