Skip to content

Commit

Permalink
Implement feedback from @ugisozols.
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed May 12, 2012
1 parent e4c0aae commit c8dabae
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pages/app/helpers/refinery/admin/pages_helper.rb
Expand Up @@ -3,15 +3,12 @@ module Admin
module PagesHelper
def parent_id_nested_set_options(current_page)
pages = []
options = nested_set_options(::Refinery::Page, current_page) do |page|
pages << page
page
end
nested_set_options(::Refinery::Page, current_page) {|page| pages << page}
# page.title needs the :translations association, doing something like
# nested_set_options(::Refinery::Page.includes(:translations), page) doesn't work, yet.
# See https://github.com/collectiveidea/awesome_nested_set/pull/123
ActiveRecord::Associations::Preloader.new(pages, :translations).run
options.map {|page, id| ["#{'-' * page.level} #{page.title}", id]}
pages.map {|page| ["#{'-' * page.level} #{page.title}", page.id]}
end
end
end
Expand Down

0 comments on commit c8dabae

Please sign in to comment.