Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Removed Object#to_html. #496

Closed
wants to merge 1 commit into from
@ebeigarts

I have removed Object#to_html because it conflicts with kramdown gem and also there are some issues reported in #151.

ActiveAdmin should avoid extending Ruby core classes.

@dmke

+1

Lost an hour on exploring why Kramdown works perfectly well in IRb but not in my Rails app. Thanks for this hint.

@kylefleming

+1

This also conflicts with Rabl. See nesquena/rabl#112

@nesquena

+1 Because adding a random method to every single Object in order to make like 2 method calls slightly more convenient may not be the best approach.

@pcreux
Collaborator

@gregbell will a look at this.

Philippe, @gregbell assistant.

@pcreux
Collaborator

This closes #151.

@jarinudom

+1

Also does not play nicely with escape_utils

@mattvague
Collaborator

@gregbell @pcreux have we come to a consensus on this one?

@jolby

+1

It would be great if this small patch were applied. It seems much cleaner and gets rid of the obnoxious warning messages in the console.

@dpmccabe

+1

Would really appreciate this patch. The log warnings in #151 make it impossible to debug anything in my app.

@turlockmike

+1 This is not a behavior i expected when i added the gem.

@jslag

+1

@pcantrell

+1 Extending core classes might be done with extreme caution, but this extension seems unnecessary and the warning are crazy-making.

@dukex

+1

@jtsagata

Yes please

@swalberg

+1 - it also breaks the ruport gem, which uses to_html for formatting a report as HTML

@pcantrell

+1 for extreme values of 1

@gregbell
Owner

Hi guys, Sorry this one took me so long to get to. I merged it into master and removed any references in Arbre to to_html.

Relevant commits: 67e27b9 and 43bc2a8

@gregbell gregbell closed this
@dukex

this is sound good @gregbell! Nice commits

@unflores

oh, Huzzah!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 19, 2011
  1. @ebeigarts

    Do not extend Object.

    ebeigarts authored
This page is out of date. Refresh to see the latest.
View
1  lib/active_admin/arbre.rb
@@ -1,5 +1,4 @@
require "active_admin/arbre/builder"
-require "active_admin/arbre/core_extensions"
require "active_admin/arbre/context"
require "active_admin/arbre/html/element"
require "active_admin/arbre/html/attributes"
View
5 lib/active_admin/arbre/core_extensions.rb
@@ -1,5 +0,0 @@
-class Object
- def to_html
- to_s
- end
-end
View
2  lib/active_admin/arbre/html/text_node.rb
@@ -27,7 +27,7 @@ def tag_name
end
def to_html
- ERB::Util.html_escape(@content.to_html)
+ ERB::Util.html_escape(@content.to_s)
end
end
View
2  spec/unit/arbre/html/element_spec.rb
@@ -96,7 +96,7 @@
it "should html escape the string" do
string = "Goodbye <br />"
element.content = string
- element.content.to_html.should == "Goodbye &lt;br /&gt;"
+ element.to_html.should == "Goodbye &lt;br /&gt;"
end
end
Something went wrong with that request. Please try again.