Skip to content

Commit

Permalink
refactor a bit
Browse files Browse the repository at this point in the history
git-svn-id: http://jnewland.com/svn/public/ruby/rails/plugins/resource_this@27 9b6b69f6-dd27-0410-8144-a0f3c56a22ea
  • Loading branch information
jnewland committed Sep 16, 2007
1 parent 8e55d79 commit 276c98a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/resource_this.rb
Expand Up @@ -32,11 +32,11 @@ def new_#{singular_name}
def create_#{singular_name}
@#{singular_name} = #{class_name}.new(params[:#{singular_name}])
@#{singular_name} = @#{singular_name}.save
created = @#{singular_name}.save
end
def update_#{singular_name}
@#{singular_name} = @#{singular_name}.update_attributes(params[:#{singular_name}])
updated = @#{singular_name}.update_attributes(params[:#{singular_name}])
end
def destroy_#{singular_name}
Expand Down Expand Up @@ -88,7 +88,7 @@ def new
def create
respond_to do |format|
if @#{singular_name}
if created
flash[:notice] = '#{class_name} was successfully created.'
format.html { redirect_to @#{singular_name} }
format.xml { render :xml => @#{singular_name}, :status => :created, :location => @#{singular_name} }
Expand All @@ -104,7 +104,7 @@ def edit
def update
respond_to do |format|
if @#{singular_name}
if updated
flash[:notice] = '#{class_name} was successfully updated.'
format.html { redirect_to @#{singular_name} }
format.xml { head :ok }
Expand Down

0 comments on commit 276c98a

Please sign in to comment.