padrino-core 0.9.17 → 0.9.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,17 @@ module Padrino
21
21
  def add_before_filter(filter)
22
22
  @before_filters ||= []
23
23
  @before_filters << filter
24
- arbitrary { |req, ps, dest| catch(:pass) { router.runner.params = ps; router.runner.instance_eval(&filter); true } == true }
24
+ arbitrary { |req, params, dest|
25
+ old_params = router.runner.params
26
+ result = catch(:pass) {
27
+ router.runner.params ||= {}
28
+ router.runner.params.merge!(params)
29
+ router.runner.instance_eval(&filter)
30
+ true
31
+ } == true
32
+ router.runner.params = old_params
33
+ result
34
+ }
25
35
  end
26
36
 
27
37
  def add_after_filter(filter)
@@ -494,7 +504,7 @@ module Padrino
494
504
  url_format = $1.to_sym if $1
495
505
 
496
506
  if !url_format && matching_types.first
497
- type = Rack::Mime::MIME_TYPES.find { |k, v| v == matching_types.first }[0].sub(/\./,'').to_sym
507
+ type = ::Rack::Mime::MIME_TYPES.find { |k, v| v == matching_types.first }[0].sub(/\./,'').to_sym
498
508
  accept_format = CONTENT_TYPE_ALIASES[type] || type
499
509
  end
500
510
 
@@ -5,7 +5,7 @@
5
5
  # without include full padrino core.
6
6
  #
7
7
  module Padrino
8
- VERSION = '0.9.17' unless defined?(Padrino::VERSION)
8
+ VERSION = '0.9.18' unless defined?(Padrino::VERSION)
9
9
  ##
10
10
  # Return the current Padrino version
11
11
  #
data/test/test_routing.rb CHANGED
@@ -929,6 +929,17 @@ class TestRouting < Test::Unit::TestCase
929
929
  assert_equal 'josh', username_from_before_filter
930
930
  end
931
931
 
932
+ should "be able to access params normally when a before filter is specified" do
933
+ mock_app do
934
+ before { }
935
+ get :index do
936
+ params.inspect
937
+ end
938
+ end
939
+ get '/?test=what'
940
+ assert_equal '{"test"=>"what"}', body
941
+ end
942
+
932
943
  should 'work with controller and arbitrary params' do
933
944
  mock_app do
934
945
  get(:testing) { params[:foo] }
@@ -1126,4 +1137,4 @@ class TestRouting < Test::Unit::TestCase
1126
1137
  post @app.url(:posts, :create, :format => :js, :bar => 'bar', :baz => 'baz', :id => 5)
1127
1138
  assert_equal "POST CREATE bar - baz - 5", body, "should properly post to create action"
1128
1139
  end
1129
- end
1140
+ end
@@ -1,2 +1,2 @@
1
1
  -1
2
- test page
2
+ test page again
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 17
10
- version: 0.9.17
9
+ - 18
10
+ version: 0.9.18
11
11
  platform: ruby
12
12
  authors:
13
13
  - Padrino Team
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-10-04 00:00:00 +02:00
21
+ date: 2010-10-05 00:00:00 -07:00
22
22
  default_executable: padrino
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency