> 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"]]
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
--~--~-~--~~~---~--~~
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
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
--~--~-~--~~~---~--~
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?