the case:

i have two classes:

class Contract < ActiveRecord::Base
serialize :addons

class Addon < ActiveRecord::Base

Now i do the following in contract_controller:

def create
@contract =[:contract])
@contract.user_id = session[:user_id]
@contract.customer_id = params[:customer_id]
@contract.pending = 1
@contract.addons =

def update
@contract = Contract.find(params[:id])
@contract.user_id = session[:user_id]
@contract.customer_id = params[:customer_id]
@contract.addons = Addon.find(:all, :conditions =>["user_id = ? && id
in (?) ",session[:user_id], Contract.get_addons(params[:addons])])

after create and update of a contract i have an serialized(YAML) array
of addons in my contract mysql-table.

the problem in view:

<% @contract.addons.each do |addon| %>
<%= %>
<% end %>

is just working under windows and not on linux!

undefined method `name’ for #YAML::Object:0x407cc7b4

I do have a name column in my addons table. Any solutions?

the output on linux

<% @contract.addons.each do |addon| %>
<%= addon.inspect %>
<% end %>

#{“name”=>“Cleaning Fee”, “updated_at”=>“2006-02-08 15:52:37”,
“per_person”=>“0”, “force_cart”=>“1”, “price”=>“40.00”, “id”=>“1”,
“onetime”=>“1”, “user_id”=>“2”, “room_id”=>“1”,
“created_at”=>“2006-02-08 15:52:37”}}>
#{“name”=>“Tax”, “updated_at”=>“2006-02-17 15:54:36”, “per_person”=>“1”,
“force_cart”=>“1”, “price”=>“2.00”, “id”=>“2”, “onetime”=>“0”,
“user_id”=>“2”, “room_id”=>“1”, “created_at”=>“2006-02-17 15:54:36”}}>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs