>From the answers I got, I guess this isn't a desired feature at the moment.
Anyway, thanks to everyone involved!
El vie., 18 may. 2018 a las 17:53, Alberto Almagro (<
albertoalma...@gmail.com>) escribió:
> Hi Abdel,
>
> sorry for the confusion, I guess I didn't explain myself properly.
>
Hi Abdel,
sorry for the confusion, I guess I didn't explain myself properly. `orders`
would be a collection composed by instances of Order model. For example,
imagine you do `Order.last(5)` to get the last 5 orders. I hope this
clarifies the example.
Cheers,
Alberto
2018-05-16 18:50 GMT+02:00
Hi,
I am new to Ruby, can you please give me an example of the orders
collection ?
Thanks.
On Wed, May 16, 2018 at 9:45 AM, Matt Jones wrote:
>
> On May 11, 2018, at 1:10 PM, Alberto Almagro
> wrote:
>
> These days I have been comparing records in
> On May 11, 2018, at 1:10 PM, Alberto Almagro wrote:
>
> These days I have been comparing records in my daily job lots of times, which
> made me think about a better way to retrieve and compare them. When I want to
> navigate through several relations in a
Hi Anthony,
thanks for your response. Great that you mention this. Yes I have seen
other Rubyists on the internet proposing a similar solution, but for me it
feels like a workaround, which could work in some cases, but it's not
ideal. My main objection for that is that it implies defining
On reading my first thought was "can
you do that by defining to_proc on Array".
A brief play suggests one can:
class Array
def to_proc
Proc.new { |arg| self.inject(arg) { |memo, f|
f.to_proc.call(memo) } }
end
end
Hi Rafael,
I'm glad to see you here. The reason I see its place here at first is
because I think its use case fits better with the framework than with the
language. When thinking on the Ruby language I would expect more to deal
with collections which contain objets like String, Integer, and
If you think that method would be useful there is no reason why it should be
Rails specific. Please send a feature request to the Ruby issue tracker here
https://bugs.ruby-lang.org/.
Rafael França
On May 11, 2018, 13:10 -0400, Alberto Almagro , wrote:
> These days I
These days I have been comparing records in my daily job lots of times,
which made me think about a better way to retrieve and compare them. When I
want to navigate through several relations in a collection I often see
myself writing code like the following:
Given orders as a collection of