Skip to content

Commit

Permalink
Use explicit find to seed selects on new action.
Browse files Browse the repository at this point in the history
  • Loading branch information
robyurkowski committed Mar 6, 2012
1 parent 3fbaebc commit 77721d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Expand Up @@ -9,7 +9,7 @@ class GalleriesController < ::Refinery::AdminController
:paging => false

def new
@gallery = ::Refinery::Portfolio::Gallery.new(params.except(:controller, :action, :switch_locale, :locale))
@gallery = ::Refinery::Portfolio::Gallery.new(:parent_id => find_parent_gallery)
end

def children
Expand All @@ -18,7 +18,11 @@ def children
end

protected


def find_parent_gallery
@parent_gallery = ::Refinery::Portfolio::Gallery.find(params[:parent_id]) if params[:parent_id].present?
end

def find_gallery
@gallery = ::Refinery::Portfolio::Gallery.find(params[:id]) if params[:id].present?
end
Expand Down
Expand Up @@ -23,7 +23,7 @@ def index
end

def new
@item = Item.new(params.except(:controller, :action, :switch_locale, :locale))
@item = Item.new(:gallery_id => find_gallery)
end

private
Expand Down

0 comments on commit 77721d0

Please sign in to comment.