From: Pim S. <pi...@li...> - 2008-05-19 20:48:24
|
Hello, Again a bindings question, sorry for asking so many questions. I hope I can answer some when I get more experienced. I have the following ActiveRecord class: class Issue < ActiveRecord::Base belongs_to :project has_many :time_entries, :dependent => :delete_all def spent_hours @spent_hours ||= time_entries.sum(:hours) || 0 #its a float end end If I retrieve spent_hours manually in de code like below it works as it should; @issues = Issue.find(:all) @issues.each do |issue| if issue.spent_hours >0 puts issue.spent_hours.to_s end end but in the NIB where I have set the Model Key Path of a table column to "spent_hours" it stays empty. Must I add some magick to the IssueProxy e.g. with on_get? Regards, Pim Snel |