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

Parent id nested set options #1633

Conversation

thedarkone
Copy link
Contributor

Manually preload :translations association to avoid the extra queries.

@travisbot
Copy link

This pull request passes (merged 868d93d into 21ab29b).

# page.title needs the :translations association, doing something like
# nested_set_options(::Refinery::Page.includes(:translations), page) doesn't work
ActiveRecord::Associations::Preloader.new(pages, :translations).run
pages.map {|i, id| ["#{'-' * i.level} #{i.title}", id]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i is the instance of page and id is nil so this produces select tree with empty values for options. Can you fix it please? Thanks!

@ugisozols
Copy link
Member

For the future - please open PR's against master branch instead of 2-0-stable. I'm asking this so that we can put new stuff in the dev branch first and only then backport needed changes/fixes to the stable branches. Thanks :)

@ugisozols
Copy link
Member

Bonus points for specs!

@thedarkone
Copy link
Contributor Author

Re-pushed, thanks for catching that!

Dev branches and specs are for sissies :).

@travisbot
Copy link

This pull request passes (merged 3e2b3ad into 21ab29b).

@ugisozols
Copy link
Member

I liked first version better because it was shorter and cleaner. All you had to do was to remove id. i already was an instance of page so you had access to page id. WDYT?

@parndt
Copy link
Member

parndt commented May 12, 2012

Merged. Specs are for people who want to ensure that we don't break your code later ;-)

@parndt
Copy link
Member

parndt commented May 12, 2012

Oh, and I merged it to master and with e4c0aae and c8dabae

@parndt
Copy link
Member

parndt commented May 12, 2012

Opened #1653 for 2-0-stable

@parndt parndt closed this May 12, 2012
ugisozols added a commit that referenced this pull request May 12, 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.

4 participants