Created
February 21, 2011 22:45
-
-
Save jrbruce/837848 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# User Model | |
class User < ActiveRecord::Base | |
has_one :account, :validate => true, :autosave => true | |
devise :database_authenticatable, :registerable, :lockable, | |
:recoverable, :rememberable, :trackable, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :first_name, :last_name, :username, :email, :password, | |
:password_confirmation, :remember_me, :account_attributes | |
validates_presence_of :first_name, :last_name#, :username | |
accepts_nested_attributes_for :account | |
end | |
# Account Model | |
class Account < ActiveRecord::Base | |
belongs_to :user | |
attr_accessible :company_name | |
validates_presence_of :company_name | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment