Hi, My model has a lot of virtual attributes. So when I use find(:all, :condition=>blablabla), can I use virtual attribute directly? eg. in my model: def mydatetime self.date+self.time end can i just use "mydatetime=xxx" to match the records in db? of course, my model is far more complicated than this. Any idea? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
you would need to define mydatetime def mydatetime=(datetime) date = datetime.some_modifier time = datetime.some_modifier end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Keynan Pratt wrote:> you would need to define mydatetime > > def mydatetime=(datetime) > date = datetime.some_modifier > time = datetime.some_modifier > endUnfortunately, it doesn''t solve the problem. Error messege: Mysql::Error: Unknown column ''who_chunk2'' in ''where clause'': SELECT * FROM `skus` WHERE (who_chunk2=''Matt'') My code is like: def who_chunk2 if !self.who_chunk.blank? if b=User.find_by_id(self.who_chunk) b.name end end end def who_chunk2=(st) if !st.blank? self.who_chunk=User.find_by_name(st).id end end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---