lib/zen/package/users/lib/users/model/user.rb in zen-0.2.4.1 vs lib/zen/package/users/lib/users/model/user.rb in zen-0.2.5
- old
+ new
@@ -1,9 +1,9 @@
#:nodoc:
module Users
#:nodoc:
- module Models
+ module Model
##
# Model that represents the very important user. This model
# can be used for both CRUD actions as well as authenticating a user.
# Passwords are encrypted using Bcrypt using the Ruby Bcrypt gem.
#
@@ -20,12 +20,12 @@
# @since 0.1
#
class User < Sequel::Model
plugin :timestamps, :create => :created_at, :update => :updated_at
- many_to_many :user_groups, :class => "Users::Models::UserGroup", :eager => [:access_rules]
- one_to_many :access_rules, :class => "Users::Models::AccessRule"
+ many_to_many :user_groups, :class => "Users::Model::UserGroup", :eager => [:access_rules]
+ one_to_many :access_rules, :class => "Users::Model::AccessRule"
##
# Try to authenticate the user based on the specified credentials.
# If the user credentials were incorrect false will be returned,
# true otherwise.
@@ -47,10 +47,10 @@
end
user = self[:email => email]
if !user.nil? and user.password == password and user.status == 'open'
- ::Zen::Controllers::BaseController.session[:user] = user
+ ::Zen::Controller::BaseController.session[:user] = user
return user
else
return false
end
end