flexible_api 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ module FlexibleApi
14
14
  @select_fields << "`#{@klass.table_name}`.#{@klass.primary_key}" # auto-select primary key
15
15
  end
16
16
 
17
- attr_reader :display_fields, :name, :notations, :scopes
17
+ attr_reader :display_fields, :name, :notations
18
18
 
19
19
  def to_hash
20
20
  {
@@ -82,6 +82,15 @@ module FlexibleApi
82
82
 
83
83
  #################################################
84
84
 
85
+ def scope_field
86
+ @scopes_array ||= begin
87
+ scopes = []
88
+ scopes.concat @scopes
89
+ @eaten_levels.each { |l| scopes.concat l.scope_field }
90
+ scopes
91
+ end
92
+ end
93
+
85
94
  def select_field
86
95
  @select_field_array ||= begin
87
96
  selects = @select_fields.to_a
@@ -1,5 +1,5 @@
1
1
  module FlexibleApi
2
2
 
3
- VERSION = '0.0.6'
3
+ VERSION = '0.0.7'
4
4
 
5
5
  end
data/lib/flexible_api.rb CHANGED
@@ -44,7 +44,7 @@ module FlexibleApi
44
44
  level = find_level(options[:request_level])
45
45
 
46
46
  query = self
47
- level.scopes.each do |s, args|
47
+ level.scope_field.each do |s, args|
48
48
  query = args.nil? ? query.send(s) : query = query.send(s, *args)
49
49
  end
50
50
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexible_api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Crepezzi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-30 00:00:00 +01:00
18
+ date: 2011-04-01 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency