Skip to content

Commit d569dc3

Browse files
committed
Fix bug with assignment public methods in 1.8.7
1 parent 7b3f2d9 commit d569dc3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/gon.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def request=(request_id)
4848

4949
def method_missing(m, *args, &block)
5050
if ( m.to_s =~ /=$/ )
51-
if public_methods.include? m.to_s[0..-2].to_sym
51+
if public_methods.include?(RUBY_VERSION =~ /1.9/ ? m.to_s[0..-2].to_sym : m.to_s[0..-2])
5252
raise "You can't use Gon public methods for storing data"
5353
end
5454
set_variable(m.to_s.delete('='), args[0])

spec/gon/gon_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
it 'returns exception if try to set public method as variable' do
6363
Gon.clear
6464
lambda { Gon.all_variables = 123 }.should raise_error
65+
lambda { Gon.rabl = 123 }.should raise_error
6566
end
6667

6768
context 'render json from rabl template' do

0 commit comments

Comments
 (0)