[Rails-core] Re: [Feature][ActiveRecord] blocklist : ignored_columns :: allowlist : feature_idea

2019-08-30 Thread Gabriel Sobrinho
I'm not from the core but in my experience the chances are better opening a PR with the feature, specially if the implementation is simple. I can even review the code, I've made a few PRs before with the implementation of the ignored columns and I'm familiar with the code. On Thursday, August

Re: [Rails-core] Re: Symlinked templates

2017-08-31 Thread Gabriel Sobrinho
I'm thinking that you may use a app helper for that. Let's say that you are using erb, you may have something like that: app/views/ shared/ _foo.html.erb _bar.html.erb v1/ some.html.erb v2/ some.html.erb You can implement a simple helper like that: <%= shared 'foo' %>

[Rails-core] Re: Symlinked templates

2017-08-31 Thread Gabriel Sobrinho
Why aren't partials a good option? On Wednesday, August 30, 2017 at 10:21:44 AM UTC-3, Cory Gwin wrote: > > Hello, > > I am exploring a possible feature for an app I am working on. Ideally we > would like to be able to symlink templates so we can use them in multiple > paths easily, partials

Re: [Rails-core] Link_to conditional classes with 'class:' feature request (and all the other helpers that take CSS classes)

2016-11-09 Thread Gabriel Sobrinho
I believe you can open the pull request, after all the core team only says yes or no after seeing the code :/ > On 8 Nov 2016, at 22:06, em...@leaplines.com wrote: > > The question im asking is only about conditions doing of classes when things > are true in the hash. My `selected?` etc

Re: [Rails-core] Link_to conditional classes with 'class:' feature request (and all the other helpers that take CSS classes)

2016-10-25 Thread Gabriel Sobrinho
This shouldn't impact the implementation, it could be literally anything (helper method, object method, local variable or anything). The specification would be { classname: true/false }. link_to user.name, user_path(user), class: { btn: true, active: user.active? } // => object method call

Re: [Rails-core] Re: Schema.rb table and column order

2015-05-20 Thread Gabriel Sobrinho
+1 What we are currently doing is remove db/schema.rb from source control but it makes us to run every migration on the CI server, what became slow as the project grows. On Tuesday, May 19, 2015 at 12:27:04 PM UTC-3, Chad Woolley wrote: +1 on allowing control over formatting, there's been

[Rails-core] Re: Fallback image for Rail's video_tag

2015-03-30 Thread Gabriel Sobrinho
Seems like you can do it using the poster option. On Sunday, March 29, 2015 at 6:30:21 PM UTC-3, Aaron Cordovez wrote: It seems like there is no way to provide a fallback image with Rail's video_tag. Is there a specific reason that the method was created this way?

[Rails-core] Re: Rails.application.config_for and Rails.config.x

2014-09-23 Thread Gabriel Sobrinho
think of a good name? On Wednesday, 17 September 2014 05:08:30 UTC+3, Gabriel Sobrinho wrote: Hello guys, I just came across this post http://www.justinweiss.com/blog/2014/08/25/the-lesser-known-features-in-rails-4-dot-2/?utm_source=rubyweeklyutm_medium=email which shows

Re: [Rails-core] Feature idea: ActiveRecord::Relation.size always returns an integer

2014-09-12 Thread Gabriel Sobrinho
I'm against to count and size works equally since I would want to know how many grouped records do I have (i.e.: how many roles do I have on determining relation). I think that count and size is working as both should. Although, if you want to count all records of a grouped relation, you have

[Rails-core] Re: HTML minification

2014-08-09 Thread Gabriel Sobrinho
I think what you need is a middleware which compresses the body, like this one: https://github.com/paolochiodi/htmlcompressor On Friday, August 8, 2014 9:05:23 PM UTC-3, Frank Tellefsen wrote: Based on https://news.ycombinator.com/item?id=8098317 (HTML minifier revisited) and specifically:

[Rails-core] ActiveRecord hook to implement an automatic eager loading feature

2014-06-25 Thread Gabriel Sobrinho
. About the to_a method, it would be necessary to receive the model instance that is calling the to_a method to do the necessary work, it would happen for all methods that can have a custom implementation: first, last, to_a, etc. What do you guys think about that? Cheers, Gabriel Sobrinho

[Rails-core] Re: ActiveRecord hook to implement an automatic eager loading feature

2014-06-25 Thread Gabriel Sobrinho
/association_shard_tracking.rb On Wednesday, June 25, 2014 9:28:36 PM UTC-3, Gabriel Sobrinho wrote: Hello guys, The Salsify Engineering team made a gem to automatic eager load associations on rails, take a look here: http://blog.salsify.com/engineering/automatic-eager-loading-rails If you want to avoid to read

Re: [Rails-core] HttpOnly cookies by default

2014-05-19 Thread Gabriel Sobrinho
to some pretty weird cookie stuff when passing data between a Rails app and non-Rails applications. The session is handy, but parsing it anywhere but in Rails is difficult and *updating* it outside of Rails is more difficult. —Matt Jones On May 17, 2014, at 9:12 AM, Gabriel Sobrinho gabriel

[Rails-core] Re: HttpOnly cookies by default

2014-05-17 Thread Gabriel Sobrinho
I would argue that if you have some information that can't be hijacked and even parsed on javascript (httponly cookies can't be read on javascript at all), why would you use cookies instead of the rails session? On Friday, May 16, 2014 7:07:42 PM UTC-3, fedesoria wrote: I would like to see

[Rails-core] Ability to customise the errors JSON response for nested attributes

2014-05-17 Thread Gabriel Sobrinho
to compute. Am I missing a way to do that or we really need to change something on active record to be able to do that? If so, where can I start? Cheers, Gabriel Sobrinho gabrielsobrinho.com -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Core group

[Rails-core] Re: Ability to customise the errors JSON response for nested attributes

2014-05-17 Thread Gabriel Sobrinho
The pull request I mentioned: https://github.com/rails/rails/pull/8638 On Saturday, May 17, 2014 10:48:43 AM UTC-3, Gabriel Sobrinho wrote: Hello guys, We’re working in some applications where we need to customise the JSON errors output in a more robust way (the front-end have a lot

[Rails-core] Re: Ability to customise the errors JSON response for nested attributes

2014-05-17 Thread Gabriel Sobrinho
Got a working prototype using a monkey patch: https://gist.github.com/sobrinho/f634f52a4ab7d47588f5 But object.errors.full_messages is not working anymore, we may need to reimplement the full_messages method. On Saturday, May 17, 2014 10:50:50 AM UTC-3, Gabriel Sobrinho wrote: The pull

[Rails-core] Re: Optional Rails initializer loading depending on Ruby plaform

2014-05-15 Thread Gabriel Sobrinho
I think you're doing it on the right way, patching the initialiser. At Gemfile you have to use: platform :ruby do gem 'mri-specific-gem' end plataform :jruby do gem 'jruby-specific-gem' end And if you need to something in a initialiser, you may check the platform using bundler stuff: if

[Rails-core] Re: Feature Request - Method to differentiate between a NullRelation and Actual Relation ?

2014-01-06 Thread Gabriel Sobrinho
That's the only way right now. Although, seems wrong to me check if a relation is a null relation, that's the point of null objects, you should not know that's a null object at all (may be necessary in your case but seems wrong to me). What you can do is something like `relation.empty?' which

Re: [Rails-core] Remove :js responder

2013-12-02 Thread Gabriel Sobrinho
. Basically, if a form is rendered through a js view, do not render the CSRF token. Homakov, that would fix the security concern without removing the .js.erb views? Cheers, Gabriel Sobrinho gabrielsobrinho.com On Dec 2, 2013, at 7:37 AM, Chris Mear chrism...@gmail.com wrote: On 2 Dec 2013

Re: [Rails-core] Remove :js responder

2013-12-02 Thread Gabriel Sobrinho
but the same idea applies, deprecate the usage on rails itself but allow who explicitly wants/needs to use. Time to pull request? Cheers, Gabriel Sobrinho gabrielsobrinho.com On Dec 2, 2013, at 12:19 PM, Egor Homakov homa...@gmail.com wrote: Apparently many readers have no clue how

Re: [Rails-core] Re: Remove :js responder

2013-12-02 Thread Gabriel Sobrinho
This fix seems great. Homakov, what do you think? May fix the problem? Cheers, Gabriel Sobrinho gabrielsobrinho.com On Dec 2, 2013, at 2:09 PM, Javan Makhmali jav...@gmail.com wrote: As many have already mentioned, enforcing request.xhr? for js requests provides adequate protection. You

Re: [Rails-core] Re: Remove :js responder

2013-11-30 Thread Gabriel Sobrinho
Homakov, What Godfrey suggest may be implemented on the server side instead of client side without being hacked so easily? We may raise an exception by default when the host is not allowed, assuming that request.host is trustable. On Saturday, November 30, 2013 7:49:42 AM UTC-2, Courtenay

Re: [Rails-core] Re: Remove :js responder

2013-11-30 Thread Gabriel Sobrinho
Not that would require to configure the application host manually like: Rails.application.config.host = 'example.com' Rails.application.config.hosts = %w(example.com example.com.br) On Saturday, November 30, 2013 12:32:30 PM UTC-2, Gabriel Sobrinho wrote: Homakov, What Godfrey suggest may

Re: [Rails-core] Re: Remove :js responder

2013-11-30 Thread Gabriel Sobrinho
Nevermind, it is not safe since the information about who is requesting is a header that can be changed. On Saturday, November 30, 2013 12:33:26 PM UTC-2, Gabriel Sobrinho wrote: Not that would require to configure the application host manually like: Rails.application.config.host

[Rails-core] Child index on validations - accepts_nested_attributes_for

2013-11-11 Thread Gabriel Sobrinho
Hey guys, I have a situation where I'm creating a object which have some items and the items have a validation that need to be executed on the server side but rails do not map these validation messages to the specific child. A contrived example may be a invoice which have 2 items and for some

Re: [Rails-core] Child index on validations - accepts_nested_attributes_for

2013-11-11 Thread Gabriel Sobrinho
Awesome, waiting for this! On Monday, November 11, 2013 2:54:42 PM UTC-2, Rafael Mendonça França wrote: https://github.com/rails/rails/pull/8638 Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Mon, Nov 11, 2013 at 2:53 PM, Gabriel Sobrinho

Re: [Rails-core] bang query methods (where!, includes!, etc.) cause indeciperable errors when called on model class

2013-11-06 Thread Gabriel Sobrinho
That’s great, thanks Xavier! Cheers, Gabriel Sobrinho gabrielsobrinho.com On Nov 6, 2013, at 5:01 PM, Xavier Noria f...@hashref.com wrote: We plan to move the API to YARD, hopefully for 4.1 unless there is something unexpected in the transition. These would be use-cases for the @private

Re: [Rails-core] bang query methods (where!, includes!, etc.) cause indeciperable errors when called on model class

2013-11-05 Thread Gabriel Sobrinho
/8c2c60511beaad05a218e73c4918ab89fb1804f0#commitcomment-2211685 Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Mon, Nov 4, 2013 at 11:53 AM, Gabriel Sobrinho gabriel@gmail.comjavascript: wrote: França, There is a reason for that? They sound useful in a lot

Re: [Rails-core] bang query methods (where!, includes!, etc.) cause indeciperable errors when called on model class

2013-11-05 Thread Gabriel Sobrinho
User.all.where! instead”) User.all.where!(email: ‘b...@example.com’) #= [] Cheers, Gabriel Sobrinho gabrielsobrinho.com On Nov 5, 2013, at 11:31 AM, Allen Madsen allen.c.mad...@gmail.com wrote: The primary reason I would be against these being public is the following example: User.where!(email

Re: [Rails-core] bang query methods (where!, includes!, etc.) cause indeciperable errors when called on model class

2013-11-05 Thread Gabriel Sobrinho
I see, makes sense, thanks! :) Cheers, Gabriel Sobrinho gabrielsobrinho.com On Nov 5, 2013, at 1:03 PM, Rafael Mendonça França rafaelmfra...@gmail.com wrote: I prefer to stick with that decision. It is easier to teach people when we say Relations are immutables than Relations

Re: [Rails-core] bang query methods (where!, includes!, etc.) cause indeciperable errors when called on model class

2013-11-04 Thread Gabriel Sobrinho
França, There is a reason for that? They sound useful in a lot of scenarios. On Wednesday, October 30, 2013 2:02:54 PM UTC-2, Rafael Mendonça França wrote: The bang methods are private and should not be used in applications (see the :nodoc: in the method definition) Rafael Mendonça França

[Rails-core] Feature Request: Track habtm changes

2013-08-22 Thread Gabriel Sobrinho
Hey guys, What do you think about tracking habtm changes? Apparently we can't do that because when you change a habtm association it is changed immediately on database instead of waiting the save call (not sure why and the problem may not be because of that). Current behaviour:

[Rails-core] Re: Feature Request: Track habtm changes

2013-08-22 Thread Gabriel Sobrinho
Not sure about how it will impact the application but this is the first shot: https://gist.github.com/sobrinho/6309391 On Thursday, August 22, 2013 12:56:27 PM UTC-3, Gabriel Sobrinho wrote: Hey guys, What do you think about tracking habtm changes? Apparently we can't do that because when

[Rails-core] Change behavior of `ActiveRecord::Base.new == ActiveRecord::Base.new`

2013-02-18 Thread Gabriel Sobrinho
Hi everyone, The active record documentation says the following: Note that new records are different from any other record by definition, unless the other record is the receiver itself. Besides, if you fetch existing records with select and leave the ID out, you’re on your own, this predicate

Re: [Rails-core] Weird (AS::Dependencies?) bug

2013-02-09 Thread Gabriel Sobrinho
I think it should be documented, maybe not on guides but somewhere. I've opened a issue about a similar subject in the past assuming that was a bug instead of the expected behavior. Note that I agree that's a advanced topic but the truth is we need to document it somewhere. I would be happy

Re: [Rails-core] Weird (AS::Dependencies?) bug

2013-02-09 Thread Gabriel Sobrinho
an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out. Cheers, Gabriel Sobrinho

Re: [Rails-core] ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-24 Thread Gabriel Sobrinho
that). object.class.increment_counter(:attr_name, object.id) object.class.update_counters(object.id, :attr_name = 1) I believe that should work fine for this purpose. On Wednesday, January 23, 2013 11:28:08 PM UTC-2, ajsharp wrote: On Wed, Jan 23, 2013 at 4:41 PM, Gabriel Sobrinho

Re: [Rails-core] ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-24 Thread Gabriel Sobrinho
concurrent update, you should use some lock and handle it. Adding documentation to talk briefly about locking should be fine I guess. On Thu, Jan 24, 2013 at 10:02 AM, Gabriel Sobrinho gabriel.sobri...@gmail.com wrote: Carlos, I'm suggesting to document this because the increment

Re: [Rails-core] Re: ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-23 Thread Gabriel Sobrinho
It makes sense! I have a debt entity in my application and payments this entity can happen three or more times in parallel (stupid brazilian banks, don't ask me why they do it). Since I have to keep a cache column of the paid value for the debt, I have 25 workers (sidekiq) that can call

Re: [Rails-core] ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-23 Thread Gabriel Sobrinho
(!) methods explaining that is not safe to use it concurrently will avoid to think they are. On Jan 23, 2013, at 4:21 PM, Matt Jones al2o...@gmail.com wrote: On Jan 23, 2013, at 4:03 AM, Gabriel Sobrinho wrote: It makes sense! I have a debt entity in my application and payments this entity can

Re: [Rails-core] PostgreSQL bulk alter

2012-11-08 Thread Gabriel Sobrinho
Nice, I will do that this week :) On Wednesday, November 7, 2012 6:39:17 PM UTC-2, Jon Leighton wrote: On 07/11/12 19:59, Gabriel Sobrinho wrote: There's a reason to postgresql adapter do not supports bulk alter? I think there's no reason other than that nobody has implement it yet, so

[Rails-core] PostgreSQL bulk alter

2012-11-07 Thread Gabriel Sobrinho
Hi, There's a reason to postgresql adapter do not supports bulk alter? I tested a bulk alter on psql and it worked to change the type of two distinct columns. If there's no reason to be disabled on postgresql adapter, I would to submit a pull request :) Cheers, Gabriel Sobrinho

[Rails-core] Re: Argument against the slow removal of DSL features in Rails, like dynamic finders

2012-11-05 Thread Gabriel Sobrinho
I always do that too :( On Sunday, November 4, 2012 11:31:01 AM UTC-2, Matt Huggins wrote: My main issue with validates is that it's easy to mix up with validate ( http://apidock.com/rails/v3.2.8/ActiveModel/Validations/ClassMethods/validate ). This is my biggest issue as well. Every

Re: [Rails-core] Suggestion: default values for models

2012-10-18 Thread Gabriel Sobrinho
That is a problem for me either. I can't use before_save callback because I need to show the default value on forms. So, I have a date field and the default value is today, but when user open the form, today must be on that field. I'm setting this kind of default value on controller like

Re: [Rails-core] When will Active Record be really Rails-independent? Concern about migrations

2012-10-17 Thread Gabriel Sobrinho
UTC+2, Gabriel Sobrinho wrote: ChuckE, It is not the best solution but some years ago I worked on a project with that case, one shared database. To solve the problem of shared migrations, we created a rails application just to run the shared migrations on the database. That required

Re: [Rails-core] When will Active Record be really Rails-independent? Concern about migrations

2012-10-16 Thread Gabriel Sobrinho
ChuckE, It is not the best solution but some years ago I worked on a project with that case, one shared database. To solve the problem of shared migrations, we created a rails application just to run the shared migrations on the database. That required an extra step before each application

Re: [Rails-core] Method capture

2012-09-11 Thread Gabriel Sobrinho
Dmitry, I commented in your gist to use the StringIO instead of Tempfile to avoid IO on disk. On Monday, September 10, 2012 6:41:38 PM UTC-3, Dmitry Vorotilin wrote: The new method, captures all descriptors, but I'm not sure about replacement original method. On Tuesday, September 11,

Re: [Rails-core] Re: Feature feedback before working and pull request please..

2012-09-10 Thread Gabriel Sobrinho
I think this problem can be fixed in so many ways... Overwrite the association method, using try on view or create a new method like that: https://gist.github.com/3655751#gistcomment-567880 You can even use a decorator :) One important point is if you need that everywhere in your system, you

Re: [Rails-core] In-memory uniqueness validator

2012-08-06 Thread Gabriel Sobrinho
Rodrigo, I don't get what you mean with nested levels :) On Aug 6, 2012, at 9:11 AM, Rodrigo Rosenfeld Rosas wrote: Em 05-08-2012 13:32, Gabriel Sobrinho escreveu: About the implementation of validation, we are using that: http://pastie.org/private/osa3pmono5l1ykrd7vipwa With regards

Re: [Rails-core] In-memory uniqueness validator

2012-08-06 Thread Gabriel Sobrinho
Rodrigo, To do that you just need to add the validation to credit card and partner. Do you mean that? http://pastie.org/private/o5zyoyqsefzhdsmwg3uoq On Aug 6, 2012, at 11:19 AM, Rodrigo Rosenfeld Rosas wrote: Em 06-08-2012 10:27, Gabriel Sobrinho escreveu: Rodrigo, I don't get what you

[Rails-core] Re: In-memory uniqueness validator

2012-08-05 Thread Gabriel Sobrinho
Anyone have some opinion? On Sunday, July 29, 2012 4:17:01 PM UTC-3, Gabriel Sobrinho wrote: Hi, Currently uniqueness validator uses database queries which not work for nested forms. For example, I have a company form which have many partners and each partner have a person

Re: [Rails-core] In-memory uniqueness validator

2012-08-05 Thread Gabriel Sobrinho
-level even though you can use validators in Ruby as well to make it easy to handle simple cases but you should always replicate the validations in the database level as well. Well, that is my opinion since you asked :) Cheers, Rodrigo. Em 05-08-2012 11:36, Gabriel Sobrinho escreveu

Re: [Rails-core] In-memory uniqueness validator

2012-08-05 Thread Gabriel Sobrinho
in a single request. Even testing such forms are painful in my opinion. It is much easier to split the application in multiple small parts that are easily testable separately. Good luck with your decisions, Rodrigo. Em 05-08-2012 12:42, Gabriel Sobrinho escreveu: Rodrigo, I'm

Re: [Rails-core] In-memory uniqueness validator

2012-08-05 Thread Gabriel Sobrinho
that: http://pastie.org/private/osa3pmono5l1ykrd7vipwa On Aug 5, 2012, at 1:21 PM, Rodrigo Rosenfeld Rosas wrote: Em 05-08-2012 13:10, Gabriel Sobrinho escreveu: Rodrigo, This approach seems very interesting but I have one question. What you do if user create a company and do not fill the partners

[Rails-core] In-memory uniqueness validator

2012-07-29 Thread Gabriel Sobrinho
complex to the proposal of uniqueness validator but that is a common validation for each system I've worked in last years. WDYT? Something like that should be on the active record or a gem? Cheers, Gabriel Sobrinho gabrielsobrinho.com -- You received this message because you are subscribed

[Rails-core] Support for views on activerecord

2012-07-11 Thread Gabriel Sobrinho
What do you guys think about adding support to handle database views in active record? Cheers, Gabriel Sobrinho -- 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

Re: [Rails-core] Re: Extract fixtures to a separate gem for Rails 4

2012-07-06 Thread Gabriel Sobrinho
My vote is to extract to a external gem. It's fine if you like fixtures, but it's fine if you like factories too. I think the benefit of release cycle decoupled from rails will be valuable. What are the downsides? On Friday, July 6, 2012 8:38:01 AM UTC-3, Rodrigo Rosenfeld Rosas wrote: One

Re: [Rails-core] Re: Extract fixtures to a separate gem for Rails 4

2012-07-06 Thread Gabriel Sobrinho
I see. What about release cycle? On Jul 6, 2012, at 1:22 PM, Xavier Noria wrote: On Fri, Jul 6, 2012 at 2:30 PM, Gabriel Sobrinho gabriel.sobri...@gmail.com wrote: My vote is to extract to a external gem. It's fine if you like fixtures, but it's fine if you like factories too

Re: [Rails-core] Extract fixtures to a separate gem for Rails 4

2012-07-06 Thread Gabriel Sobrinho
ok, thanks for explanation Xavier :) On Jul 6, 2012, at 3:52 PM, Xavier Noria wrote: On Fri, Jul 6, 2012 at 6:30 PM, Gabriel Sobrinho gabriel.sobri...@gmail.com wrote: I see. What about release cycle? Well, in the case of Rails the value of extracting something like this to a gem

[Rails-core] Default value for case sensitive on uniqueness validator

2012-06-06 Thread Gabriel Sobrinho
team agree :) Cheers, Gabriel Sobrinho -- 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 this group, send email to rubyonrails-core+unsubscr

[Rails-core] Transaction during all migrations instead of each migrations

2012-06-01 Thread Gabriel Sobrinho
because mysql do not support ddl transactions. What you think, guys? Cheers, Gabriel Sobrinho -- 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

Re: [Rails-core] Re: Simple idea for simplifying client-side code test built-in in Rails

2012-05-25 Thread Gabriel Sobrinho
I started to use konacha on my rails applications and it feels so right. Would be great to have something like konacha integrated on rails applications or at least as default suggestion on Gemfile like happens with coffe-script. On Friday, May 25, 2012 12:58:44 AM UTC-3, Rodrigo Rosenfeld

[Rails-core] Typecast values on change_column for postgresql

2012-05-25 Thread Gabriel Sobrinho
Hello, Currently if you have a string column that have only number values (think a year column using string by mistake) and you want to change to integer, you can't. If you apply this monkey-patch will be possible: https://gist.github.com/1393441 Note: if some value can't be casted by

Re: [Rails-core] Allow to use Proc on :order option of associations

2012-05-04 Thread Gabriel Sobrinho
: Core group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. Cheers, Gabriel

[Rails-core] Allow to use Proc on :order option of associations

2012-05-03 Thread Gabriel Sobrinho
Take a look (not my production code but reproduces the desired behavior): ``` ruby class Post ActiveRecord::Base attr_accessible :published_at, :name has_and_belongs_to_many :categories, :order = lambda { [Category.arel_table[:published_at].desc, Category.arel_table[:name]] } end ``` ```