[Rails-core] define_methods functionality

2012-10-04 Thread Тіма Маслюченко
Hi guys I am thinking about new feature(maybe it already exists, in thie case let me know) Can you pelase review and provide some feedbacks, if you find it usefull of course We can put in inside active_support So i need define methods that return nil(or other value that is similar for all

Re: [Rails-core] define_methods functionality

2012-10-04 Thread Robert Pankowecki
What is the usecase? What value does it provide ? How is it any better than ? def title; nil; end def type; nil; end Maybe it is just me but I totally do not get what your are trying to achieve. Robert Pankowecki -- You received this message because you are subscribed to the Google Groups

Re: [Rails-core] define_methods functionality

2012-10-04 Thread Piotr Sarnacki
Thanks for your proposal, but it's probably too narrow use case to extend rails with it. Also, it may look weird to do a few similar methods that just return nil, but at least it's easy to understand - if I don't know what does define_methods do, I would need to check implementation or

[Rails-core] has_many behaviour on new records

2012-10-04 Thread robbytobby
Hey I' m quite surprised by the behaviour of has_many associations on new_records, so might someone here tell me if I'm simply missing the point or is it a Bug? ruby 1.9.3p265 Rails 3.2.8 class Invoice ActiveRecord::Base has_many :bikes, :dependent = :nullify end class Bike

Re: [Rails-core] has_many behaviour on new records

2012-10-04 Thread widu
Thanks for your fast reply. I just checked out the 3-2-stable branch and the count problem is fixed. However the sum issue ruby-1.9.3-head :003 Invoice.new.bikes.sum(:price) Bike Load (30.4ms) SELECT bikes.* FROM bikes WHERE bikes.invoice_id IS NULL = 809577.5 still remains. But the same

Re: [Rails-core] has_many behaviour on new records

2012-10-04 Thread Rafael Mendonça França
Yes, are are acknowledged of these issues but we didn't figure out the best way to solve they. See https://github.com/rails/rails/issues/5215 Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Thu, Oct 4, 2012 at 3:15 PM, widu

Re: [Rails-core] conditional eager loading

2012-10-04 Thread Corey Haines
Would merge work? Something like (off the top of my head): Shift.includes(:schedules).merge(Schedule.occuring_on(Date.today)) where .occuring_on is def self.occuring_on(day) where(:occurs_on = day) end -Corey On Thu, Oct 4, 2012 at 3:44 PM, r1git erwan.ha...@gmail.com wrote: Does anybody

[Rails-core] Re: Renaming Journey and avoiding libraries with common noun names

2012-10-04 Thread Gary Weaver
Got constance working and it is sweet like candy (like old-tyme candy back before they knew how to make candy, so forgive me if it sucks). This might solve the common-noun constant problem. Try it out and let me know. https://github.com/garysweaver/constance On Saturday, September 22, 2012