Skip to content

Instantly share code, notes, and snippets.

@caike
Created January 22, 2011 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caike/790790 to your computer and use it in GitHub Desktop.
Save caike/790790 to your computer and use it in GitHub Desktop.
setting time zone
class AddDefaultTimeZoneToUsers < ActiveRecord::Migration
def self.up
change_column_default :account_settings, :time_zone, 'EST'
end
def self.down
change_column :account_settings, :time_zone, :string, nil
end
end
# POST /users
# POST /users.xml
def create
@user = User.new(params[:user])
# @account_setting = AccountSetting.new(params[:account_setting])
# @account_setting.time_zone = 'EST'
if @user.save
# @account_setting.user = @user
# @account_setting.save
redirect_to(@user, :notice => 'User was successfully created.')
else
render :action => "new"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment