Re: [Rails-core] Array grouping methods with index

2011-05-14 Thread Juanjo Bazán
> Can't you just use the enumerators that are built in to Array itself? > For example: > >    irb(main):006:0> x = %w(1 2 3 4 5 6 7) >    => ["1", "2", "3", "4", "5", "6", "7"] >    irb(main):007:0> x.each_slice(3).each_with_index { |(a, b, c), i| >      p [i, [a, b, c]] } >    [0, ["1", "2", "3"]]

[Rails-core] Re: Avoiding clone in AR::Base#attributes

2008-02-11 Thread Juanjo Bazán
As nobody reports any breakage, it seems natural to implement the same behaviour to attributes_before_type_cast as well. Here is the patch to avoid cloning in attributes_before_type_cast: http://dev.rubyonrails.org/ticket/11077 Cheers, Juanjo --~--~-~--~~~---~--~~

[Rails-core] Avoiding clone in AR::Base#attributes

2008-02-08 Thread Juanjo Bazán
Hi, I've changed the ActiveRecord::Base#attributes method to avoid cloning of objects and increase apps performance. Here is the patch: http://dev.rubyonrails.org/ticket/11047 This sure speeds up the method avoiding Kernel#clone calls, but I don't know if there is any special case where not cloning

[Rails-core] Re: +3 patch needs a better name for an options key passed to map.resources

2008-01-27 Thread Juanjo Bazán
I would suggest :name_in_path as the name for the key. I think the meaning of map.resources :products, :other_name=>'productos' do is not inferred directly, but map.resources :products, :name_in_path=>'productos' do is (almost) self-explanatory --~--~-~--~~~---~--~

[Rails-core] Re: Page caching for URLs with a trailing slash

2007-11-28 Thread Juanjo Bazán
BTW, about the trailing slash, there is a inconsistency with the url_for methods in Base and in UrlWriter (you can create urls with trailing slash with one method but not with the other). This issue is addressed in a patch here: http://dev.rubyonrails.org/ticket/9117 May someone take a look at it?