kelredd-sinatra-helpers 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,7 +57,8 @@ module SinatraHelpers::Erb::Partials
57
57
  def partial(path, locals={}, &subject_block)
58
58
  raise "locals must be specified with a Hash" unless locals.kind_of?(::Hash)
59
59
  params = _partial_params(path, locals, subject_block)
60
- if params[:subject] && params[:subject].respond_to?(:collect)
60
+ # locals[:object] takes precedence over whatever calculated subject
61
+ if locals.delete(:object).nil? && params[:subject] && params[:subject].respond_to?(:collect)
61
62
  counter = 0
62
63
  params[:subject].collect do |subject|
63
64
  erb(params[:path], params[:options].merge({
@@ -87,7 +88,7 @@ module SinatraHelpers::Erb::Partials
87
88
  nil
88
89
  end ||
89
90
  locals.delete(:collection) ||
90
- locals.delete(:object) ||
91
+ locals[:object] || # don't remove it from the locals hash just yet
91
92
  locals.delete(name),
92
93
  :locals => locals.delete(:locals) || locals,
93
94
  :options => { :layout => false },
@@ -1,4 +1,4 @@
1
- ENV["RACK_ENV"] ||= "development"
1
+ ENV["RACK_ENV"] ||= "development" unless defined? RACK_ENV
2
2
  require 'app'
3
3
  set :app_file, File.join(root_path, 'app.rb')
4
4
  disable :run
@@ -3,7 +3,7 @@ module SinatraHelpers
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 2
6
- TINY = 3
6
+ TINY = 4
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3
9
- version: 0.2.3
8
+ - 4
9
+ version: 0.2.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kelly Redding
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-05 00:00:00 -05:00
17
+ date: 2010-04-08 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency