accessible_attributes 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,7 +1,9 @@
1
1
  *.gem
2
2
  .bundle
3
3
  .redcar
4
+ .rvmrc
4
5
  .yardoc
6
+ Gemfile.lock
5
7
  log/*.log
6
8
  pkg
7
9
  doc/*
data/README.md CHANGED
@@ -9,10 +9,10 @@ episode 237.
9
9
 
10
10
  ## Installation
11
11
 
12
- Add the following line to your Gemfile
12
+ Add the following line to your `Gemfile`
13
13
  gem 'accessible_attributes'
14
14
 
15
- Then run `bundle install` and you're good to go
15
+ Then run `bundle install` and you're good to go.
16
16
 
17
17
  ## Usage
18
18
 
@@ -43,12 +43,12 @@ For more information, see the [Railscasts] episode or read it on [Asciicasts]
43
43
  commit by itself I can ignore when I pull)
44
44
  * Send me a pull request. Bonus points for topic branches.
45
45
 
46
- == Copyright
46
+ ## Copyright
47
47
 
48
48
  Copyright (c) 2010 Steven Hancock. See MIT-LICENSE for details.
49
49
 
50
-
51
50
  [1]: http://www.pledgie.com/campaigns/14171
52
51
  [2]: http://www.pledgie.com/campaigns/14171.png?skin_name=chrome
53
52
  [Railscasts]: http://railscasts.com/episodes/237-dynamic-attr-accessible
54
53
  [Asciicasts]: http://asciicasts.com/episodes/237-dynamic-attr-accessible
54
+
@@ -4,7 +4,7 @@ require "accessible_attributes/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "accessible_attributes"
7
- s.version = AccessibleAttributes::VERSION
7
+ s.version = AccessibleAttributes::Version::STRING
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Steven Hancock"]
10
10
  s.email = ["stevenh512@gmail.com"]
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_dependency("actionpack", "~> 3.0.3")
20
20
  s.add_dependency("activerecord", "~> 3.0.3")
21
+ s.add_dependency("activesupport", "~> 3.0.3")
21
22
 
22
- s.add_development_dependency("activesupport", "~> 3.0.3")
23
23
  s.add_development_dependency("bundler", "~> 1.0.7")
24
24
  s.add_development_dependency("rake", "~> 0.8.7")
25
25
  s.add_development_dependency("rdiscount", "~> 1.6.5")
@@ -1,19 +1,7 @@
1
- require 'active_record'
2
- require 'action_dispatch'
3
- require 'active_record/session_store'
1
+ require 'active_support/concern'
2
+ require 'accessible_attributes/active_record/base'
3
+ require 'accessible_attributes/active_record/session_store'
4
4
 
5
- ActiveRecord::Base.class_eval do
6
- attr_accessible
7
- attr_accessor :accessible
5
+ ActiveRecord::Base.send(:include, AccessibleAttributes::ActiveRecord::Base)
8
6
 
9
- private
10
- def mass_assignment_authorizer
11
- if accessible == :all
12
- self.class.protected_attributes
13
- else
14
- super + (accessible || [])
15
- end
16
- end
17
- end
18
-
19
- ActiveRecord::SessionStore::Session.send(:attr_accessible, :session_id)
7
+ ActiveRecord::SessionStore::Session.send(:include, AccessibleAttributes::ActiveRecord::SessionStore)
@@ -0,0 +1,25 @@
1
+ require 'active_record'
2
+
3
+ module AccessibleAttributes
4
+ module ActiveRecord
5
+ module Base
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ attr_accessible
10
+ attr_accessor :accessible
11
+ end
12
+
13
+ module InstanceMethods
14
+ private
15
+ def mass_assignment_authorizer
16
+ if accessible == :all
17
+ self.class.protected_attributes
18
+ else
19
+ super + (accessible || [])
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,14 @@
1
+ require 'action_dispatch'
2
+ require 'active_record/session_store'
3
+
4
+ module AccessibleAttributes
5
+ module ActiveRecord
6
+ module SessionStore
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ attr_accessible :session_id
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,8 @@
1
1
  module AccessibleAttributes
2
- VERSION = "0.0.4"
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 5
6
+ STRING = [MAJOR, MINOR, PATCH].join(".")
7
+ end
3
8
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Steven Hancock
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-15 00:00:00 -08:00
17
+ date: 2010-12-20 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -59,7 +59,7 @@ dependencies:
59
59
  - 0
60
60
  - 3
61
61
  version: 3.0.3
62
- type: :development
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: *id003
65
65
  - !ruby/object:Gem::Dependency
@@ -165,12 +165,13 @@ files:
165
165
  - .gitignore
166
166
  - .rspec
167
167
  - Gemfile
168
- - Gemfile.lock
169
168
  - MIT-LICENSE
170
169
  - README.md
171
170
  - Rakefile
172
171
  - accessible_attributes.gemspec
173
172
  - lib/accessible_attributes.rb
173
+ - lib/accessible_attributes/active_record/base.rb
174
+ - lib/accessible_attributes/active_record/session_store.rb
174
175
  - lib/accessible_attributes/version.rb
175
176
  - log/.gitkeep
176
177
  - spec/accessible_attributes_spec.rb
@@ -196,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
197
  requirements:
197
198
  - - ">="
198
199
  - !ruby/object:Gem::Version
199
- hash: -827957135
200
+ hash: 385511073
200
201
  segments:
201
202
  - 0
202
203
  version: "0"
data/Gemfile.lock DELETED
@@ -1,70 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- accessible_attributes (0.0.4)
5
- actionpack (~> 3.0.3)
6
- activerecord (~> 3.0.3)
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- abstract (1.0.0)
12
- actionpack (3.0.3)
13
- activemodel (= 3.0.3)
14
- activesupport (= 3.0.3)
15
- builder (~> 2.1.2)
16
- erubis (~> 2.6.6)
17
- i18n (~> 0.4)
18
- rack (~> 1.2.1)
19
- rack-mount (~> 0.6.13)
20
- rack-test (~> 0.5.6)
21
- tzinfo (~> 0.3.23)
22
- activemodel (3.0.3)
23
- activesupport (= 3.0.3)
24
- builder (~> 2.1.2)
25
- i18n (~> 0.4)
26
- activerecord (3.0.3)
27
- activemodel (= 3.0.3)
28
- activesupport (= 3.0.3)
29
- arel (~> 2.0.2)
30
- tzinfo (~> 0.3.23)
31
- activesupport (3.0.3)
32
- arel (2.0.6)
33
- builder (2.1.2)
34
- diff-lcs (1.1.2)
35
- erubis (2.6.6)
36
- abstract (>= 1.0.0)
37
- i18n (0.5.0)
38
- rack (1.2.1)
39
- rack-mount (0.6.13)
40
- rack (>= 1.0.0)
41
- rack-test (0.5.6)
42
- rack (>= 1.0)
43
- rake (0.8.7)
44
- rdiscount (1.6.5)
45
- rspec (2.3.0)
46
- rspec-core (~> 2.3.0)
47
- rspec-expectations (~> 2.3.0)
48
- rspec-mocks (~> 2.3.0)
49
- rspec-core (2.3.0)
50
- rspec-expectations (2.3.0)
51
- diff-lcs (~> 1.1.2)
52
- rspec-mocks (2.3.0)
53
- sqlite3-ruby (1.3.2)
54
- tzinfo (0.3.23)
55
- yard (0.6.3)
56
-
57
- PLATFORMS
58
- ruby
59
-
60
- DEPENDENCIES
61
- accessible_attributes!
62
- actionpack (~> 3.0.3)
63
- activerecord (~> 3.0.3)
64
- activesupport (~> 3.0.3)
65
- bundler (~> 1.0.7)
66
- rake (~> 0.8.7)
67
- rdiscount (~> 1.6.5)
68
- rspec (~> 2.3.0)
69
- sqlite3-ruby (~> 1.3.2)
70
- yard (~> 0.6.3)