ActiveAdmin/Rabl::Engine conflict #112

Closed
kylefleming opened this Issue Sep 22, 2011 · 6 comments

Comments

Projects
None yet
3 participants
Contributor

kylefleming commented Sep 22, 2011

There's a conflict with Rabl::Engine.request_format when ActiveAdmin is installed.

The offending line in ActiveAdmin (https://github.com/gregbell/active_admin/blob/master/lib/active_admin/arbre/core_extensions.rb) causes the rabl engine to think it can respond to to_html, except that it just calls to_s, which returns "#<Rabl::Engine:0x007fa36b0de178>". This is really only an issue when you don't specify a request format.

An example output from my failing rspec:

1) api/users/me.rabl should return a valid user
   Failure/Error: rendered.should == ''
   expected: ""
   got: "#<Rabl::Engine:0x007fa36b0de178>" (using ==)
   # ./spec/views/api/user_spec.rb:16:in `block (2 levels) in <top (required)>'

I'm not sure how you want to proceed, but I thought you should be aware of this conflict.

For reference, my solution was to call Object.send :remove_method, :to_html in my spec_helper.rb

Owner

nesquena commented Sep 23, 2011

Wow that core extension is fairly insane. They overwrite to_html on every single class?

Contributor

kylefleming commented Sep 23, 2011

Completely insane. I think I'll create a ticket in their project as well.

Contributor

kylefleming commented Sep 23, 2011

It's already been reported in ActiveAdmin and someone has a pull request in. See gregbell/active_admin#496

Owner

nesquena commented Sep 23, 2011

Glad to see someone has a sane pull request. Hilarious that it only requires changing two method calls and the monkeypatch becomes totally unnecessary.

zdennis commented Sep 23, 2011

It seems like this issue is not an issue with RABL and can be closed then, no/

Owner

nesquena commented Sep 23, 2011

Yep, agreed. Closing, hopefully that will be pulled in soon.

@nesquena nesquena closed this Sep 23, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment