[Rails-core] Re: Encapsulate Relation#calculate into a subquery

2012-08-14 Thread Andrew Vit
For consistency, `relation.count`, `relation.group(:assoc).count`, and `relation.to_a.count` should *all* return **Fixnum**s... In #7121, I opened the discussion about separating `count` into a `count_by(:column)` method. Currently there's a deprecation on `count(:group => :column)`, which adv

Re: [Rails-core] Backporting instructions in Contributing guide

2012-08-14 Thread Xavier Noria
On Mon, Aug 13, 2012 at 10:50 PM, Godfrey Chan wrote: +1 > > I think I wrote the original guide on back porting and this definitely > sounds like a better approach. > Sounds good. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post

Re: [Rails-core] Activerecord: how to write a new feature?

2012-08-14 Thread Rodrigo Rosenfeld Rosas
Em 13-08-2012 21:49, Rafael Almeida escreveu: On Sunday, August 12, 2012 12:06:00 AM UTC-3, Matt jones wrote: On Aug 11, 2012, at 6:23 PM, Rafael Almeida wrote: > On Friday, August 10, 2012 5:50:58 PM UTC-3, EMoreth wrote: > Try this: > > Project.joins(:services).where(:s

Re: [Rails-core] Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)

2012-08-14 Thread Gary Weaver
Steve, Thanks for your response! If you plan to use PATCH, you should figure out what you need and use it. > I had read: http://weblog.rubyonrails.org/2012/2/25/edge-rails-patch-is-the-new-primary-http-method-for-updates/ It states that: Because of that, the PATCH

Re: [Rails-core] Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)

2012-08-14 Thread Steve Klabnik
> I'm basically just trying to understand what Rails 4 plans to offer with > regard to patching, Here is the relevant commit: https://github.com/rails/rails/commit/002713c64 The commit message gives a pretty decent overview. This is basically just a baby-step forward; but adding direct support fo

[Rails-core] Could requirement for _attributes suffix for association names in mass assignment security and model data go away in Rails 4?

2012-08-14 Thread Gary Weaver
When using mass assignment security (attr_accessible, attr_protected) and accepts_nested_attributes_for, and when passing in the associated models in a request, an _attributes suffix must be added to the key/name of the attribute, even though accepts_nested_attributes_for does not require the _

Re: [Rails-core] Could requirement for _attributes suffix for association names in mass assignment security and model data go away in Rails 4?

2012-08-14 Thread Steve Klabnik
Even better: mass assignment security is going away: https://github.com/rails/strong_parameters -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from th

Re: [Rails-core] Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)

2012-08-14 Thread Gary Weaver
Steve, Thanks! I was under the impression that patch might actually allow patch updates in some planned future version of Rails 4 by only specifying attributes (and attributes of associated models through accepts_nested_attributes_for) that the client requests to update. If everything is being

Re: [Rails-core] Could requirement for _attributes suffix for association names in mass assignment security and model data go away in Rails 4?

2012-08-14 Thread Carlos Antonio da Silva
As an addition, accepts_nested_attributes is a feature *meant* for associations, whereas mass assignment helpers - attr_accessible and friends - are not. I don't think it's that worth to change it in a way to check for associations when they're called for each attribute, that'd be a lot of effort f

Re: [Rails-core] Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)

2012-08-14 Thread Steve Klabnik
> Should I put in a ticket for that? This is exactly where feature requests go. So you kinda already did. ;) > If you are trying to do a patch, then JSON in the request could be easily > converted to model representation in Rails. But just handling off the > implementation of a patch to the devel

Re: [Rails-core] Could requirement for _attributes suffix for association names in mass assignment security and model data go away in Rails 4?

2012-08-14 Thread Gary Weaver
Steve, Cool! I just went back and read a post that a co-worker sent me a link to: http://broadcastingadam.com/2012/03/state_of_rails_apis/ That post mentioned "I hope that dhh's strong paramters is merged into Rails 4", and I didn't know that was planned to be the case now. I didn't see it in t

Re: [Rails-core] Could requirement for _attributes suffix for association names in mass assignment security and model data go away in Rails 4?

2012-08-14 Thread Steve Klabnik
The work is being done here: https://github.com/rails/rails/tree/integrate-strong_parameters I'm not sure what the timetable is. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@google