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

Allow nesting of Jbuilder objects #23

Merged
merged 4 commits into from Aug 8, 2012

Conversation

Projects
None yet
7 participants
@bigjason
Copy link
Contributor

bigjason commented Feb 15, 2012

Small change that detects when another jbuilder object is being added. This allows chaining objects together in a manner similar to partials. Very useful when using jbuilder outside of rails templates.

A contrived example:

class Person
  def to_builder
    person = Jbuilder.new
    person.(self, :name, :age)
  end
end

class Company
  def to_builder
    company = Jbuilder.new
    company.name name
    company.president president.to_builder
  end
end

puts company.to_builder.target!
Allow nesting of Jbuilder objects
Small change that detects when another jbuilder object is being added.
This allows a higher degree of code reuse.
@dhh

This comment has been minimized.

Copy link
Member

dhh commented Mar 23, 2012

I like this. Please include README docs in your pull and we can merge.

@bigjason

This comment has been minimized.

Copy link
Contributor Author

bigjason commented Mar 23, 2012

Will do. Thanks.

@bigjason

This comment has been minimized.

Copy link
Contributor Author

bigjason commented Mar 23, 2012

@dhh I added the docs. Let me know if anything else is needed for this.

@tysonmote

This comment has been minimized.

Copy link

tysonmote commented Apr 4, 2012

+1

4 similar comments
@inossidabile

This comment has been minimized.

Copy link
Contributor

inossidabile commented Apr 9, 2012

+1

@maletor

This comment has been minimized.

Copy link

maletor commented Apr 20, 2012

+1

@eviltrout

This comment has been minimized.

Copy link

eviltrout commented May 11, 2012

+1

@cicloid

This comment has been minimized.

Copy link

cicloid commented Jul 31, 2012

👍

dhh added a commit that referenced this pull request Aug 8, 2012

Merge pull request #23 from bigjason/nestable-jbuilder
Allow nesting of Jbuilder objects

@dhh dhh merged commit fcebaad into rails:master Aug 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.