brightcontent-core 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightcontent-core (2.0.2)
4
+ brightcontent-core (2.0.3)
5
5
  bcrypt-ruby
6
6
  bootstrap-wysihtml5-rails
7
7
  has_scope
@@ -5,19 +5,23 @@ module Brightcontent
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  module ClassMethods
8
- def per_page(number)
9
- @per_page_count = number
8
+ def per_page_count
9
+ @per_page_count ||= 30
10
10
  end
11
11
 
12
- def per_page_count
13
- @per_page_count || 30
12
+ def per_page(number)
13
+ @per_page_count = number
14
14
  end
15
15
  end
16
16
 
17
17
  private
18
18
 
19
19
  def end_of_association_chain
20
- super.paginate(page: params[:page], per_page: self.class.per_page_count)
20
+ if action_name == "index"
21
+ super.paginate(page: params[:page], per_page: self.class.per_page_count)
22
+ else
23
+ super
24
+ end
21
25
  end
22
26
 
23
27
  end
@@ -23,7 +23,7 @@ module Brightcontent
23
23
  if route && route[:action] == "index"
24
24
  route[:controller].match(/brightcontent\/(.+)/)[1]
25
25
  end
26
- end.compact
26
+ end.compact.uniq
27
27
  end
28
28
 
29
29
  def routes_hash
@@ -1,8 +1,5 @@
1
1
  require "brightcontent/routes_parser"
2
2
 
3
- class Blog ; end
4
- class Article ; end
5
-
6
3
  module Brightcontent
7
4
  describe RoutesParser do
8
5
  let(:engine_resources) { %w{sessions admin_users} }
@@ -30,5 +27,13 @@ module Brightcontent
30
27
  it { should eq ["blogs"] }
31
28
  end
32
29
 
30
+ context "duplicate resources" do
31
+ before do
32
+ routes_hash << {action: "index", controller: "brightcontent/blogs" }
33
+ end
34
+
35
+ it { should eq ["blogs"] }
36
+ end
37
+
33
38
  end
34
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightcontent-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -341,7 +341,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
341
341
  version: '0'
342
342
  segments:
343
343
  - 0
344
- hash: -4292959386572265707
344
+ hash: -1697021567461287672
345
345
  required_rubygems_version: !ruby/object:Gem::Requirement
346
346
  none: false
347
347
  requirements:
@@ -350,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
350
350
  version: '0'
351
351
  segments:
352
352
  - 0
353
- hash: -4292959386572265707
353
+ hash: -1697021567461287672
354
354
  requirements: []
355
355
  rubyforge_project:
356
356
  rubygems_version: 1.8.24