Closed abrisse closed 11 years ago
Which version on rabl-rails
do you used?
0.3.1
There is only one place in the code source where I used start_with?
without using to_s
before it when dealing with assigns in action_controller
.
Which version of rails are you using? Do you use another gem that deals with controller or it is vanilla rails ?
I am using rails 3.2.13. The problem only occurs with rspec. Is there any way to see the compiled view '_app_views_v__medias_show_rabl___3750579331352501291_55842580' ?
Hmm, I also use RSpec and I never ran into this issue. No the compiled view is from ActionView
so I don't really know if you can see it.
But, you can try to monkey patch RablRails in you spec_helper.rb
with this:
module RablRails
module Renderers
class Base
private
def setup_render_context
@_context.instance_variable_get(:@_assigns).each_pair { |k, v|
instance_variable_set("@#{k}", v) unless k.to_s.start_with?('_')
}
end
end
end
end
That should fix your issue, and I will include it in the next release.
Yep it fixes the problem. Thanks!
I close this issue but you should create an entry in the Wiki addressing this problem.
Added in #37
I switched from rabl to rabl-rails. It works great except during the tests (rspec).
My view:
My test:
The error: