Skip to content

Commit

Permalink
Revert "Improve readability."
Browse files Browse the repository at this point in the history
This reverts commit 1023cd0.

This commit apparently proved far too controversial and instead the entire
crud should be refactored to make it easier / do less.
  • Loading branch information
parndt committed Oct 2, 2013
1 parent 61dbc1a commit 72a12ef
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions core/lib/refinery/crud.rb
Expand Up @@ -69,7 +69,10 @@ def new
def create
if (@#{singular_name} = #{class_name}.create(params[:#{singular_name}])).valid?
flash.notice = t('refinery.crudify.created', :what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'")
flash.notice = t(
'refinery.crudify.created',
:what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'"
)
create_or_update_successful
else
Expand All @@ -83,7 +86,10 @@ def edit
def update
if @#{singular_name}.update_attributes(params[:#{singular_name}])
flash.notice = t('refinery.crudify.updated', :what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'")
flash.notice = t(
'refinery.crudify.updated',
:what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'"
)
create_or_update_successful
else
Expand Down Expand Up @@ -116,7 +122,9 @@ def find_#{singular_name}_scope
# It will be ordered based on the conditions specified into crudify
# And eager loading is applied as specified into crudify.
def find_all_#{plural_name}(conditions = #{options[:conditions].inspect})
@#{plural_name} = find_#{singular_name}_scope.where(conditions).order("#{options[:order]}")
@#{plural_name} = find_#{singular_name}_scope
.where(conditions)
.order("#{options[:order]}")
end
def merge_position_into_params!
Expand Down

0 comments on commit 72a12ef

Please sign in to comment.