Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveAdmin/Rabl::Engine conflict #112

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

ActiveAdmin/Rabl::Engine conflict #112

kylefleming opened this issue Sep 22, 2011 · 6 comments

Comments

@kylefleming
Copy link
Contributor

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
Copy link
Owner

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

@kylefleming
Copy link
Contributor Author

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

@kylefleming
Copy link
Contributor Author

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

@nesquena
Copy link
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
Copy link

zdennis commented Sep 23, 2011

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

@nesquena
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants