Hallo Werner Am 11.08.2007 18:56 Uhr schrieb "Werner Laude" unter <[EMAIL PROTECTED]>:
> Thomas R. Koll schrieb: > Hallo... > > danke soweit.. aber das klappt noch nicht.. >> >> also: >> class Honor < ActiveRecord:Base >> has_one :picture >> end >> class Picture < ActiveRecord:Base >> belongs_to :honor >> end >> > > @honors = Honor.find(:all) > <%for honor in @honors %> > <%=honor.title %> # wert kommt > <%= honor.picture.image_name %> # ergibt |You have a nil object Bist Du die sicher das bei dir jedes honor ein Bild hat? Denn sonst rufst Du image_name auf ein NIL-Objekt auf. Probier doch mal folgendes: <% Honor.find(:all).each do |h| %> <%= h.picture.image_name unless h.picture.nil? %> <% end %> Herliche Grüße, Michael > > oder auch so rum > | > <% @honors.each do |h| -%> > <%= h.picture.image_name %> # ergibt |You have a nil object | > <% end -%> > > > > @ Nicolai => @honor.picture.bildname ?? > > wo soll das stehen ? > > Gruß > > _______________________________________________ rubyonrails-ug mailing list [email protected] http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug
