Skip to content
Browse files

replaced string constant with symbol

  • Loading branch information...
1 parent d149089 commit 7cf85a6b6ad3176672da4b07aca4002d2f2abc11 @tomcz tomcz committed Mar 11, 2010
View
16 app/controllers/products_controller.rb
@@ -36,12 +36,7 @@ def new
# GET /products/1/edit
def edit
product = Product.find(params[:id])
-
- conversation = Conversation.new
- conversation.ref_id = product.id
- conversation.context = 'product'
- conversation.save!
-
+ conversation = Conversation.create! :ref_id => product.id, :context => 'product'
redirect_to :action => 'form', :id => conversation
end
@@ -80,9 +75,7 @@ def create
else
format.html {
conversation = Conversation.get_or_create(params[:conversation_id])
- conversation.parameters = params[:product]
- conversation.context = 'product'
- conversation.save!
+ conversation.update_attributes! :parameters => params[:product], :context => 'product'
redirect_to :action => 'form', :id => conversation
}
format.xml { render :xml => product.errors, :status => :unprocessable_entity }
@@ -106,10 +99,7 @@ def update
else
format.html {
conversation = Conversation.get_or_create(params[:conversation_id])
- conversation.parameters = params[:product]
- conversation.ref_id = product.id
- conversation.context = 'product'
- conversation.save!
+ conversation.update_attributes! :ref_id => product.id, :parameters => params[:product], :context => 'product'
redirect_to :action => 'form', :id => conversation
}
format.xml { render :xml => product.errors, :status => :unprocessable_entity }
View
4 app/controllers/store_controller.rb
@@ -52,9 +52,7 @@ def save_order
redirect_to_index("Thank you for your order")
else
conversation = Conversation.get_or_create(params[:id])
- conversation.parameters = params[:order]
- conversation.context = 'order'
- conversation.save!
+ conversation.update_attributes! :parameters => params[:order], :context => 'order'
redirect_to :action => 'checkout', :id => conversation
end
end
View
16 app/controllers/users_controller.rb
@@ -36,12 +36,7 @@ def new
# GET /users/1/edit
def edit
user = User.find(params[:id])
-
- conversation = Conversation.new
- conversation.ref_id = user.id
- conversation.context = 'user'
- conversation.save!
-
+ conversation = Conversation.create! :ref_id => user.id, :context => 'user'
redirect_to :action => 'form', :id => conversation
end
@@ -80,9 +75,7 @@ def create
else
format.html {
conversation = Conversation.get_or_create(params[:conversation_id])
- conversation.parameters = params[:user]
- conversation.context = 'user'
- conversation.save!
+ conversation.update_attributes! :parameters => params[:user], :context => 'user'
redirect_to :action => 'form', :id => conversation
}
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
@@ -106,10 +99,7 @@ def update
else
format.html {
conversation = Conversation.get_or_create(params[:conversation_id])
- conversation.parameters = params[:user]
- conversation.ref_id = @user.id
- conversation.context = 'user'
- conversation.save!
+ conversation.update_attributes! :ref_id => @user.id, :parameters => params[:user], :context => 'user'
redirect_to :action => 'form', :id => conversation
}
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }

0 comments on commit 7cf85a6

Please sign in to comment.
Something went wrong with that request. Please try again.