Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ActiveAdmin/Rabl::Engine conflict #112

Closed
kylefleming opened this Issue · 6 comments

3 participants

@kylefleming

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

@nesquena
Owner

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

@kylefleming

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

@kylefleming

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

@nesquena
Owner

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

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

@nesquena
Owner

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

@nesquena nesquena closed this
@ismaelga ismaelga referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@ismaelga ismaelga referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.