Permalink
Browse files

replaced string constant with symbol

  • Loading branch information...
1 parent 0334ce4 commit 2c185e14a3c1c9aa8d00d1f23e33c3fc319797dd @tomcz tomcz committed Mar 10, 2010
@@ -28,7 +28,7 @@ def show
# GET /products/new.xml
def new
respond_to do |format|
- format.html { redirect_to :action => 'form', :id => Conversation::NEW_ID }
+ format.html { redirect_to :action => 'form', :id => :new }
format.xml { render :xml => Product.new }
end
end
@@ -26,14 +26,14 @@ def empty_cart
end
def new_order
- redirect_to :action => 'checkout', :id => Conversation::NEW_ID
+ redirect_to :action => 'checkout', :id => :new
end
def checkout
@cart = find_cart
conversation = Conversation.get_or_create(params[:id])
if conversation.new_record?
- @conversation_id = Conversation::NEW_ID
+ @conversation_id = :new
@order = Order.new
else
@conversation_id = conversation.id
@@ -28,7 +28,7 @@ def show
# GET /users/new.xml
def new
respond_to do |format|
- format.html { redirect_to :action => 'form', :id => Conversation::NEW_ID }
+ format.html { redirect_to :action => 'form', :id => :new }
format.xml { render :xml => User.new }
end
end
@@ -1,14 +1,12 @@
class Conversation < ActiveRecord::Base
- NEW_ID = 'new'
-
set_primary_key :uuid
include UUIDHelper
serialize :parameters
def self.get_or_create(uuid)
- if uuid == NEW_ID
+ if uuid.to_sym == :new
self.new
else
conversation = self.find_by_uuid(uuid)

0 comments on commit 2c185e1

Please sign in to comment.