Problem with symbols: Value is stored with "--- :symbolname"


#1

Hi to everyone,

I’ve a problem with symbols and my application.
There are 4 fields defined as string which receive a symbol from code:

  1. stato (status)
  2. fase (phase)
  3. spedizione (shipment)
  4. pagamento (payment)

Well, only the status field shows a weird behaviour.
There is only one point, so far, in the source where I assign a value to
that
field and the code I wrote is:

def conferma
@order = Order.find(session[:ordine])
@order.stato = :confermato
@order.save!
empty_cart
end

Now, when I read back the order for display purposes, when the field
“stato” is
displayed, something like: “— :value” is shown.

This thing doesn’t happen to the rest above mentioned fields.

Here follows the migration stuff:

create_table :orders do |t|
  t.column :user_id, :integer
  t.column :user_ip, :string
  t.column :created_at, :timestamp
  t.column :updated_at, :timestamp
  t.column :stato, :string, :default => 'aperto'
  t.column :fase, :string
  t.column :spedizione, :string, :default => 'pacco1'
  t.column :pagamento, :string, :default => 'bonifico'
  t.column :indirizzo, :string
  t.column :civico, :integer
  t.column :cap, :integer
  t.column :comune, :string
  t.column :provincia, :string
  t.column :telefono, :string
  t.column :email, :string
  t.column :note, :string
end

Is there anything I could check to fix this thing?
I’ve tried with grep on the whole source tree to find a possible flaw in
the source code. Still, no luck.

Thanks in advance for your help.


#2

Nevermind, just figured out that a simple “serialize(attribute_name)” in
the class solved the problem.

Thanks anyway.