From 3dfaf4a9f25cd8cfb88d5c458adeab49bfb2ceff Mon Sep 17 00:00:00 2001 From: luu stiles Date: Tue, 22 May 2012 00:16:07 -0600 Subject: added fields for twitter and facebooks; view, model, updated with fields and migration script created and run --- app/models/user.rb | 2 +- app/views/registrations/edit.html.erb | 8 ++++++++ db/migrate/20120522060801_add_details_to_users.rb | 6 ++++++ db/schema.rb | 4 +++- 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20120522060801_add_details_to_users.rb diff --git a/app/models/user.rb b/app/models/user.rb index 1cf4c8d1..33a9e8a1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,7 +2,7 @@ class User < ActiveRecord::Base validates :name, :presence => true has_many :authentications devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable - attr_accessible :name, :email, :website, :password, :password_confirmation, :remember_me + attr_accessible :name, :email, :website, :twitter, :facebook, :password, :password_confirmation, :remember_me has_many :creations, :dependent => :destroy has_many :favorites, :dependent => :destroy diff --git a/app/views/registrations/edit.html.erb b/app/views/registrations/edit.html.erb index c76ab961..9749954d 100644 --- a/app/views/registrations/edit.html.erb +++ b/app/views/registrations/edit.html.erb @@ -45,6 +45,14 @@
<%= f.label :website, :class => "control-label" %>
<%= f.url_field :website, :class => "input-xlarge, url", :placeholder => "http://cakeside.com" %>
+
+
+ <%= f.label :twitter, :class => "control-label" %> +
<%= f.text_field :twitter, :class => "input-xlarge", :placeholder => "@CakeSide" %>
+
+
+ <%= f.label :facebook, :class => "control-label" %> +
<%= f.text_field :facebook, :class => "input-xlarge", :placeholder => "http://www.facebook.com/your_profile" %>
diff --git a/db/migrate/20120522060801_add_details_to_users.rb b/db/migrate/20120522060801_add_details_to_users.rb new file mode 100644 index 00000000..aef9de42 --- /dev/null +++ b/db/migrate/20120522060801_add_details_to_users.rb @@ -0,0 +1,6 @@ +class AddDetailsToUsers < ActiveRecord::Migration + def change + add_column :users, :twitter, :string + add_column :users, :facebook, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 9a6283b2..413fe781 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120517125545) do +ActiveRecord::Schema.define(:version => 20120522060801) do create_table "active_admin_comments", :force => true do |t| t.integer "resource_id", :null => false @@ -96,6 +96,8 @@ ActiveRecord::Schema.define(:version => 20120517125545) do t.datetime "updated_at", :null => false t.string "name" t.string "website" + t.string "twitter" + t.string "facebook" end add_index "users", ["email"], :name => "index_users_on_email", :unique => true -- cgit v1.2.3