decent_exposure 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +8 -7
  2. data/VERSION +1 -1
  3. data/lib/decent_exposure/railtie.rb +17 -0
  4. metadata +29 -13
data/README.md CHANGED
@@ -16,12 +16,19 @@ Installation
16
16
 
17
17
  gem install decent_exposure
18
18
 
19
- Configure your application to use it:
19
+ Configure your Rails 2.X application to use it:
20
20
 
21
21
  In `config/environment.rb`:
22
22
 
23
23
  config.gem 'decent_exposure'
24
24
 
25
+ When used in Rails 3, you must require the Railtie initializer:
26
+
27
+ In `Gemfile`:
28
+
29
+ gem 'decent_exposure', :require => ['decent_exposure', 'decent_exposure/railtie']
30
+
31
+
25
32
  The Particulars
26
33
  ---------------
27
34
 
@@ -94,12 +101,6 @@ The given block will be invoked in the context of a controller instance. It is
94
101
  possible to provide a custom default for a descendant class without disturbing
95
102
  its ancestor classes in an inheritance heirachy.
96
103
 
97
- **Caveat**: Note that the simplest way to provide custom default `expose` logic
98
- for all of your controllers is to invoke `default_exposure` inside of
99
- `ApplicationController`. Due to the order of Rails' initialization logic,
100
- attempts to invoke it in `ActionController::Base` will have no affect. Use an
101
- initializer if you need this behavior.
102
-
103
104
  Beware
104
105
  ------
105
106
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -0,0 +1,17 @@
1
+ module DecentExposure
2
+ class Railtie < Rails::Railtie
3
+ railtie_name :decent_exposure
4
+
5
+ initializer "decent_exposure.extend_action_controller_base" do |app|
6
+ ActionController::Base.class_eval do
7
+ extend DecentExposure
8
+ superclass_delegating_accessor :_default_exposure
9
+ default_exposure do |name|
10
+ model_class = name.to_s.classify.constantize
11
+ model_class.find(params["#{name}_id"] || params['id'])
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decent_exposure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 3
9
+ version: 0.2.3
5
10
  platform: ruby
6
11
  authors:
7
12
  - Stephen Caudill
@@ -10,29 +15,37 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2010-02-25 00:00:00 -05:00
18
+ date: 2010-04-10 00:00:00 -04:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
17
22
  name: rspec
18
- type: :development
19
- version_requirement:
20
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
21
25
  requirements:
22
26
  - - ">="
23
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 2
31
+ - 9
24
32
  version: 1.2.9
25
- version:
33
+ type: :development
34
+ version_requirements: *id001
26
35
  - !ruby/object:Gem::Dependency
27
36
  name: mocha
28
- type: :development
29
- version_requirement:
30
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
31
39
  requirements:
32
40
  - - ">="
33
41
  - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 9
45
+ - 8
34
46
  version: 0.9.8
35
- version:
47
+ type: :development
48
+ version_requirements: *id002
36
49
  description: "\n DecentExposure helps you program to an interface, rather than an implementation\n in your Rails controllers. The fact of the matter is that sharing state\n via instance variables in controllers promotes close coupling with views.\n DecentExposure gives you a declarative manner of exposing an interface to the\n state that controllers contain and thereby decreasing coupling and\n improving your testability and overall design.\n "
37
50
  email: scaudill@gmail.com
38
51
  executables: []
@@ -46,6 +59,7 @@ files:
46
59
  - README.md
47
60
  - VERSION
48
61
  - lib/decent_exposure.rb
62
+ - lib/decent_exposure/railtie.rb
49
63
  - rails/init.rb
50
64
  has_rdoc: true
51
65
  homepage: http://github.com/voxdolo/decent_exposure
@@ -60,18 +74,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
74
  requirements:
61
75
  - - ">="
62
76
  - !ruby/object:Gem::Version
77
+ segments:
78
+ - 0
63
79
  version: "0"
64
- version:
65
80
  required_rubygems_version: !ruby/object:Gem::Requirement
66
81
  requirements:
67
82
  - - ">="
68
83
  - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
69
86
  version: "0"
70
- version:
71
87
  requirements: []
72
88
 
73
89
  rubyforge_project:
74
- rubygems_version: 1.3.5
90
+ rubygems_version: 1.3.6
75
91
  signing_key:
76
92
  specification_version: 3
77
93
  summary: A helper for creating declarative interfaces in controllers