casey_jones 0.0.117 → 0.0.118

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,31 @@
1
+ module CaseyJones
2
+ module ActionControllerClassMethods
3
+ def resource_attributes(*parameters)
4
+ for action in [:show, :new, :edit, :create]
5
+ a = "def #{action};" + ([:new, :create].include?(action) ?
6
+ "@#{resource_class.name.underscore} = resource_class.new;" : ""
7
+ ) +
8
+ parameters.map{|p|
9
+ if p.class == Hash
10
+ meth, prm = [p.to_a.flatten[0], p.to_a.flatten[1]]
11
+ else
12
+ meth, prm = [p, p]
13
+ end
14
+ meth = meth.to_s + "="
15
+
16
+ if prm == :current_user
17
+ val = "current_user"
18
+ else
19
+ val = "params[:#{prm}]"
20
+ end
21
+ "resource.send(\"#{meth}\", #{val})"
22
+ }.join(";") +
23
+ ";#{action}!;end;"
24
+ class_eval a
25
+ puts a
26
+ end
27
+ end
28
+ end
29
+ end
30
+ ActionController::Base.extend CaseyJones::ActionControllerClassMethods
31
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casey_jones
3
3
  version: !ruby/object:Gem::Version
4
- hash: 245
4
+ hash: 243
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 117
10
- version: 0.0.117
9
+ - 118
10
+ version: 0.0.118
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Gannon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-17 00:00:00 -07:00
18
+ date: 2010-08-22 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -32,6 +32,7 @@ files:
32
32
  - README
33
33
  - Rakefile
34
34
  - install.rb
35
+ - lib/action_controller_extensions/action_controller_extensions.rb
35
36
  - lib/acts_as_linkable/acts_as_linkable.rb
36
37
  - lib/ajax_loading/action_controller_extensions.rb
37
38
  - lib/ajax_loading/active_record_extensions.rb