effective_posts 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eca3438b280dc68df0a2068bc09754ebdf9d11f5
4
- data.tar.gz: e84fcb3c11970fe9f60f3917c4bbcf97cd39ce5f
3
+ metadata.gz: 67d4f4c53d2b315bab9f9d64444fe9d7293a028c
4
+ data.tar.gz: c410bbe65c851e8cf3623aeb41391812deae99c3
5
5
  SHA512:
6
- metadata.gz: 8e8f78680d751d43fd2cc15b7daff3150075601522d6f330fc3b2ce18132a560c3704e915d5e176540aa38008f4eed95e9344298db47715255e62dbd66b1a21d
7
- data.tar.gz: f572bc531f7f88a3a093b97d3f543db5bb8b00c7db8f35eeaa9ed0b0cbbcf700c9499cb87af8b96d69dd1a6e0f8bfc073a7e0c8a332b17edd4ac3578da14c4d3
6
+ metadata.gz: 51c85c563406546e794d6c057fae118e8dd44ca4459f7b87ed8957e4e24cfef127942026606d650eafca829211c6ea4bb85cf338b3f92c3b6940484aa75e6a70
7
+ data.tar.gz: 12f20e77a16e05dda25596faf128d7c56b0af6de63ecb62471239c5c6f775aa2d7170da1f4678f2685eb634bb3efd35215e8e4766e32bef9191204e443912f7e
@@ -7,13 +7,10 @@ module Effective
7
7
  def index
8
8
  @posts = (Rails::VERSION::MAJOR > 3 ? Effective::Post.all : Effective::Post.scoped)
9
9
 
10
- if defined?(EffectiveRoles) && (current_user.respond_to?(:roles) rescue false)
11
- @posts = @posts.for_role(current_user.roles)
12
- end
13
-
14
- @posts = @posts.includes(:regions)
10
+ @posts = @posts.for_role(current_user.try(:roles)) if defined?(EffectiveRoles)
15
11
  @posts = @posts.with_category(params[:category]) if params[:category]
16
12
  @posts = @posts.published
13
+ @posts = @posts.includes(:regions)
17
14
 
18
15
  @posts = @posts.order("#{EffectivePosts.posts_table_name}.published_at DESC")
19
16
  @posts = @posts.page(params[:page]).per(EffectivePosts.per_page)
@@ -26,13 +23,10 @@ module Effective
26
23
  def show
27
24
  @posts = (Rails::VERSION::MAJOR > 3 ? Effective::Post.all : Effective::Post.scoped)
28
25
 
29
- if defined?(EffectiveRoles) && (current_user.respond_to?(:roles) rescue false)
30
- @posts = @posts.for_role(current_user.roles)
31
- end
32
-
33
- @posts = @posts.includes(:regions)
26
+ @posts = @posts.for_role(current_user.try(:roles)) if defined?(EffectiveRoles)
34
27
  @posts = @posts.with_category(params[:category]) if params[:category]
35
28
  @posts = @posts.published if params[:edit].to_s != 'true'
29
+ @posts = @posts.includes(:regions)
36
30
 
37
31
  @post = @posts.find(params[:id])
38
32
 
@@ -1,3 +1,3 @@
1
1
  module EffectivePosts
2
- VERSION = "0.2.0"
2
+ VERSION = '0.2.1'.freeze
3
3
  end
@@ -25,7 +25,7 @@ EffectivePosts.setup do |config|
25
25
  config.post_meta_author = true
26
26
 
27
27
  # Use CanCan: authorize!(action, resource)
28
- # Use effective_roles: resource.roles_match_with?(current_user)
28
+ # Use effective_roles: resource.roles_permit?(current_user)
29
29
  config.authorization_method = Proc.new { |controller, action, resource| true }
30
30
 
31
31
  # Layout Settings
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_posts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails