Re: [Rails-core] ActiveRecord chained order calls composed

2014-04-14 Thread Al Tenhundfeld
+1 I don't think of ActiveRecord as an API for manipulating collections of data but instead an API for composing queries (and mapping data, etc.). I don't know what's "correct", but it feels intuitive to me that order calls would be composed consistently with where calls. -Al On Mon, Apr 14, 201

Re: [Rails-core] ActiveRecord chained order calls composed

2014-04-14 Thread James Coleman
We could debate all day what the "correct" way to do it is, but the reality is that (and this has been discussed before) that this would be a tremendously breaking API change, and therefore shouldn't be done regardless. I will add my 2 cents though on the idea: I don't think that comparing relatio

Re: [Rails-core] Enum, ActiveModel and I18n

2014-04-14 Thread Rafael Mendonça França
Could you please provide a concrete example of what you need from enum feature? How would you like to use? Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Mon, Apr 14, 2014 at 9:53 PM, Sadjow Leão wrote: > Yeap, T.J. > > But, actually enums are not onl

Re: [Rails-core] Enum, ActiveModel and I18n

2014-04-14 Thread Sadjow Leão
Yeap, T.J. But, actually enums are not only for persisted AR objects, we can find enumerations where we can have a pre-defined list of values. A validation doesn't matter here. I'need the same enum API for a model. Without this behaviour in ActiveModel, we will end up making a similar behaviour

[Rails-core] Putting logger at the end of the middleware chain

2014-04-14 Thread Josh Bourgeois
Hi, I was just wondering if there would be any reason I shouldn't do this, like problems with tags or something. Currently we're taking Cookies and CookieStore and inserting them before Logger in the stack, which feels just a tad more dangeresque than moving the logger to the bottom of the stac

[Rails-core] ActiveRecord chained order calls composed

2014-04-14 Thread Cameron Martin
When chaining calls to order on an ActiveRecord association, the result is a composition of the two order calls. I believe this breaks the principle of least surprise, since calling sort/order on a collection never behaves like this anywhere else (for example with Array#sort). Any subsequent c

Re: [Rails-core] Enum, ActiveModel and I18n

2014-04-14 Thread T.J. Schuck
> Why not put Enum into ActiveModel? We may need some enumeration into another model without ActiveRecord, a example: something like a mail object form with a enumeration for subject… If the object isn’t persisted to the DB, it doesn’t seem like you’d need to use AR::Enum — the primary benefit is

Re: [Rails-core] Enum, ActiveModel and I18n

2014-04-14 Thread Rafael Mendonça França
Hi, Could you explain a bit more about the use case you are thinking for enum feature on Active Model? By what you described I believe you can reach with validates_inclusion_ofand a hash. An example of the controller and view would help. Also, could you also explain what is the use case for i18n

[Rails-core] Enum, ActiveModel and I18n

2014-04-14 Thread Sadjow Leão
Hi folks, I'm thinking about a Pull Request for Rails. But, I want to validate with you. Why not put Enum into ActiveModel? We may need some enumeration into another model without ActiveRecord, a example: something like a mail object form with a enumeration for subject... and other situations.