typus 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,20 +23,20 @@ module Typus
23
23
  #++
24
24
  def current_user
25
25
 
26
- user = Typus.user_class.find(session[:typus_user_id])
26
+ @current_user ||= Typus.user_class.find(session[:typus_user_id])
27
27
 
28
- unless Typus::Configuration.roles.has_key?(user.role)
28
+ unless Typus::Configuration.roles.has_key?(@current_user.role)
29
29
  raise _t("Role does no longer exists.")
30
30
  end
31
31
 
32
- unless user.status
32
+ unless @current_user.status
33
33
  back_to = (request.env['REQUEST_URI'] == admin_dashboard_path) ? nil : request.env['REQUEST_URI']
34
34
  raise _t("Typus user has been disabled.")
35
35
  end
36
36
 
37
- I18n.locale = user.preferences[:locale]
37
+ I18n.locale = @current_user.preferences[:locale]
38
38
 
39
- return user
39
+ return @current_user
40
40
 
41
41
  rescue Exception => error
42
42
  session[:typus_user_id] = nil
data/lib/typus/format.rb CHANGED
@@ -64,11 +64,9 @@ module Typus
64
64
  render format => data.send("to_#{format}", :methods => methods, :except => except)
65
65
  end
66
66
 
67
- def data(*args)
67
+ def data
68
68
  eager_loading = @resource.reflect_on_all_associations(:belongs_to).map { |i| i.name }
69
- options = { :joins => @joins, :conditions => @conditions, :order => @order, :include => eager_loading }
70
- options.merge!(args.extract_options!)
71
- @resource.all(options)
69
+ @resource.joins(@joins).where(@conditions).order(@order).includes(eager_loading)
72
70
  end
73
71
 
74
72
  end
data/lib/typus/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Typus
2
- VERSION = "3.0.1"
2
+ VERSION = "3.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 1
10
- version: 3.0.1
9
+ - 2
10
+ version: 3.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Francesc Esplugas
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-19 00:00:00 +02:00
18
+ date: 2010-10-22 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency