app/models/user.rb in artfully_ose-1.2.0.pre.5 vs app/models/user.rb in artfully_ose-1.2.0.pre.6
- old
+ new
@@ -21,14 +21,14 @@
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :user_agreement, :newsletter_emails, :first_name, :last_name, :user_memberships_attributes
def is_in_organization?
- !!(user_memberships.any? && ! user_memberships.first.organization.new_record?)
+ @is_in_organization ||= !!(user_memberships.any? && ! user_memberships.first.organization.new_record?)
end
def current_organization
- is_in_organization? ? user_memberships.first.organization : Organization.new
+ @current_organization ||= is_in_organization? ? user_memberships.first.organization : Organization.new
end
def membership_in(organization)
user_memberships.where(:organization_id => organization.id).limit(1).first
end