controller_resources 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b490004ef78f9c21c3c72bb3d8de57c7ce52bde
4
- data.tar.gz: 90ceb34f2312f142bf0a9aeab4d4ff55fc1a9709
3
+ metadata.gz: a6adb74a8b9c88d7da3c10ee6cb427d9f421075c
4
+ data.tar.gz: 6ff37e39ae45febfc41bb6138384a67d7f5afbbd
5
5
  SHA512:
6
- metadata.gz: d968d9c6ebad11cf03786a310ede7006a45d0277275987cfaf9c0e1083dff79615f02519248d0bea53cc5c6981f0887de44164b5f3529275555c332a92f08fa0
7
- data.tar.gz: 1d224b6827f81280155ac18f94d485aa86a937ab6c4ea78b4d23d53515e1b0f46c155471e44ef6decbcd16920ab9f4b33607904a25a5eced6ff94b044d2cd9bf
6
+ metadata.gz: 74b2881705eb65079e7735709571990f173a72a8e4feba6516b81f4c6b04a18c8d7e17bb3a9685423fdd7d24f8f99da89efc0ab9ec051a4887843c83abd0f976
7
+ data.tar.gz: 070a4f87cd9b16913bcecb5bba8fb7692c7254d738aa52cb7caf91cd500c4af5b1d7fbc5dba3879321ccb3c0f04920b98040cc5838cfc6cca89898c83bcd3d23
@@ -1,10 +1,9 @@
1
1
  module ControllerResources
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace ControllerResources
4
- config.to_prepare do
5
- require 'controller_resources'
6
4
 
7
- class ApplicationController < ActionController::Base
5
+ config.to_prepare do
6
+ ApplicationController.class_eval do
8
7
  include ControllerResources::Extension
9
8
  end
10
9
  end
@@ -53,6 +53,7 @@ module ControllerResources
53
53
  #{model_class}.where(search_params)
54
54
  end
55
55
  #{authenticate if defined? Devise}
56
+ #{authorize if defined? Authority}
56
57
  RUBY
57
58
 
58
59
  yield if block_given?
@@ -74,8 +75,16 @@ module ControllerResources
74
75
  "before_action :authenticate_user!, except: %w(index show)"
75
76
  end
76
77
 
78
+ def authorize
79
+ "authorize_actions_for #{model_class}"
80
+ end
81
+
77
82
  def model_class
78
- @model_class ||= model.classify
83
+ @model_class ||= self._singleton_resource.to_s.classify
84
+ end
85
+
86
+ def model
87
+ self._singleton_resource
79
88
  end
80
89
 
81
90
  def collection
@@ -1,3 +1,3 @@
1
1
  module ControllerResources
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: controller_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Scott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-08 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler