Last active
December 11, 2015 21:28
-
-
Save SET001/4662209 to your computer and use it in GitHub Desktop.
This file contains 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
class User < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, | |
# :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :recoverable, :rememberable, :trackable | |
# :registerable, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :first_name, :last_name, :country, :city, :address, :phone, :email, :password, :password_confirmation, :remember_me | |
# attr_accessible :title, :body | |
has_many :users_roles | |
has_many :roles, :through => :users_roles | |
def as_json(options = nil) | |
res = {} | |
[:first_name, :last_name, :country, :city, :address, :phone, :email, :last_sign_in_at].each do |el, index| | |
res[el] = self[el] | |
end | |
res | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment