Skip to content

Instantly share code, notes, and snippets.

@jrbruce
Created February 21, 2011 22:45
Show Gist options
  • Save jrbruce/837848 to your computer and use it in GitHub Desktop.
Save jrbruce/837848 to your computer and use it in GitHub Desktop.
# 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