Skip to content

Commit

Permalink
fix embedded scaffolds with constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed Mar 30, 2012
1 parent 9d65d03 commit 739cc6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/active_scaffold/actions/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module ActiveScaffold::Actions
module Core
def self.included(base)
base.class_eval do
before_filter :register_constraints_with_action_columns, :if => :embedded?
after_filter :clear_flashes
end
base.helper_method :nested?
Expand All @@ -17,6 +18,9 @@ def render_field
end

protected
def embedded?
@embedded ||= params.delete(:embedded)
end

def nested?
false
Expand Down
5 changes: 2 additions & 3 deletions lib/active_scaffold/actions/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def list

protected
def list_respond_to_html
if params.delete(:embedded)
if embedded?
render :action => 'list', :layout => false
else
render :action => 'list'
Expand All @@ -32,8 +32,7 @@ def list_respond_to_html
def list_respond_to_js
if params[:adapter]
render(:partial => 'list_with_header')
elsif params[:embedded]
params.delete(:embedded)
elsif embedded?
render(:partial => 'list_with_header')
else
render :action => 'refresh_list', :formats => [:js]
Expand Down

0 comments on commit 739cc6e

Please sign in to comment.