Commit a72eae9e

mo k <mo@mokhan.ca>
2012-05-17 12:58:47
add website property to the User model and create migration.
1 parent 224be57
app/controllers/registrations_controller.rb
@@ -3,6 +3,11 @@ class RegistrationsController < Devise::RegistrationsController
     super
     session[:omniauth] = nil unless @user.new_record?
   end
+
+  #def update
+    #logger.log(params)
+    #super
+  #end
   
   private
   
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, :password, :password_confirmation, :remember_me
+  attr_accessible :name, :email, :website, :password, :password_confirmation, :remember_me
   has_many :creations, :dependent => :destroy
   has_many :favorites, :dependent => :destroy
 
app/views/registrations/edit.html.erb
@@ -37,7 +37,7 @@
         </div><!-- /control-group -->
         <div class="control-group">
           <%= f.label :website, :class => "control-label" %> 
-          <div class="controls"> <%= f.password_field :website, :class => "input-xlarge" %> </div>
+          <div class="controls"> <%= f.text_field :website, :class => "input-xlarge" %> </div>
         </div><!-- /control-group -->
         <div class="form-actions">
           <input type="submit" class="btn btn-primary" value="Save changes" />
db/migrate/20120517125545_add_website_to_users.rb
@@ -0,0 +1,5 @@
+class AddWebsiteToUsers < ActiveRecord::Migration
+  def change
+    add_column :users, :website, :string
+  end
+end
db/schema.rb
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20120301034745) do
+ActiveRecord::Schema.define(:version => 20120517125545) do
 
   create_table "active_admin_comments", :force => true do |t|
     t.integer  "resource_id",   :null => false
@@ -95,6 +95,7 @@ ActiveRecord::Schema.define(:version => 20120301034745) do
     t.datetime "created_at",                                            :null => false
     t.datetime "updated_at",                                            :null => false
     t.string   "name"
+    t.string   "website"
   end
 
   add_index "users", ["email"], :name => "index_users_on_email", :unique => true