resourceful_loader 0.0.1 → 0.0.2

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.
@@ -25,6 +25,8 @@ module ResourcefulLoader
25
25
 
26
26
  method_name = "load_#{resource_name}"
27
27
 
28
+ ivar_name = (options.delete(:as) || resource_name).to_s
29
+
28
30
  while private_instance_methods.include? method_name
29
31
  method_name.sub! /(?:_([0-9]+))?$/ do |f|
30
32
  "_#{ f.blank? ? 1 : f.to_i + 1 }"
@@ -46,7 +48,7 @@ module ResourcefulLoader
46
48
  return false
47
49
  end
48
50
 
49
- instance_variable_set :"@#{resource_name}", resource
51
+ instance_variable_set :"@#{ivar_name}", resource
50
52
  end
51
53
 
52
54
  private method_name
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resourceful_loader
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - jbr
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-14 00:00:00 -07:00
18
+ date: 2010-10-28 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -29,7 +29,6 @@ extensions: []
29
29
  extra_rdoc_files: []
30
30
 
31
31
  files:
32
- - lib/resourceful_helper.rb
33
32
  - lib/resourceful_loader.rb
34
33
  has_rdoc: true
35
34
  homepage: http://github.com/jbr/resourceful_loader
@@ -1,15 +0,0 @@
1
- module ResourcefulHelper
2
- def render_object_partial(object, options = {})
3
- singular = object.class.to_s.underscore
4
- plural = singular.pluralize
5
- to = options.delete :to
6
- render_options = {:partial => "#{plural}/#{singular}", :locals => {singular.to_sym => object}.merge(options)}
7
-
8
- if to
9
- string = controller.send(:render_to_string, render_options)
10
- to.to_sym == :json ? string.to_json : string
11
- else
12
- render render_options
13
- end
14
- end
15
- end