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

Added numeric ability for text nodes. #470

Closed
wants to merge 1 commit into from

Conversation

bobbytables
Copy link

I discovered that table_for (and any tag really) created with Arbre with the content of a numeric value would just not display anything. For example:

table_for(article) do
  column("Article Comments") { |a| a.comments_count }
end

The column for comments will be blank because "comments_count" is a number.
The code in builder.rb prevents this on this line:

if tag.is_a?(String)
  current_dom_context << Arbre::HTML::TextNode.from_string(tag)
end

I added spec but wasn't sure if it was to par, sorry if isn't.

@ebeigarts
Copy link
Contributor

This has been already reported in #154 and it also accepts any object that has to_s method.

@ghost ghost assigned gregbell Jan 11, 2012
gregbell added a commit that referenced this pull request Jan 11, 2012
Before this commit:

  index do
    column("My Column"){ 1 }
  end

Would result in an empty column. Now the object is appended to the DOM
and will result in a colum of "1"s.

The return value is ignored if the user has already appended other
elements to the DOM. This might trip up some users, however it is more
likely that you are either going to build up a DOM structure or return a
simple value, not both.

Thanks for the pull requests from @bobbytables and @utkarshkukreti

References isses #470, 154
@gregbell
Copy link
Contributor

Fixed on master in 9cb2b90

@gregbell gregbell closed this Jan 11, 2012
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

Successfully merging this pull request may close these issues.

3 participants