ja hallo erstmal,..

ich sitze mal wieder vor einem complex-Form nach RailsCasts 73.

Der Code (im model:) 

  def save_children
    [contact_combies,contact_interactions,events].each do |c|
      unless c.should_ignore?
        if c.should_destroy?
          c.destroy
        else
          c.save(false)
        end
      end
    end
  end
Sollte eigentlich die referenzierten Objekte abspeichern.
Jedoch wirft er den Fehler:

undefined method `should_ignore?' for ContactCombi:Class

Obwohl in der Klasse ContactCombi diese Methode existiert:
def should_ignore?
    should_ignore.to_i == 1
  end
und benutzbar ist:

ruby script/console
c = ContactCombi.new
=> #<ContactCombi:0xb71313f4 @attributes={... }, @new_record=true>
>> c.should_ignore = "1"
=> "1"
>> c.should_ignore?
=> true

Woran könnte das liegen?

Danke, 
Keep smiling
yanosz
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an