#reload doesn't work to you?
Rafael Mendonça França
http://twitter.com/rafaelfranca
https://github.com/rafaelfranca
On Thu, Feb 28, 2013 at 2:30 AM, Will Bryant will.bry...@gmail.com wrote:
The thing that's got worse is having to write different code for
associations vs. relations.
On 28/02/13 05:30, Will Bryant wrote:
The thing that's got worse is having to write different code for
associations vs. relations. Currently #all will behave exactly the same
way on both, which is very useful because you can write code on a model
class that works the same way whether it's
You have to use reload.to_a to work with everything (enumerable methods for
eg.).
Can we have a method that does this and make it part of the stable API, please?
That's what #all has always done and it's pretty basic functionality.
On 1/03/2013, at 01:42 , Rafael Mendonça França
On 28 Feb 2013, at 21:46, Will Bryant will.bry...@gmail.com wrote:
You have to use reload.to_a to work with everything (enumerable methods for
eg.).
Can we have a method that does this and make it part of the stable API,
please? That's what #all has always done and it's pretty basic
Hi guys,
I don't think that the changes made to the behavior of #all in 4.0 are a very
good idea.
I can see that you no longer need to call all in as many cases as you did
before - that's fine, just don't call it if you don't want it. But that
doesn't mean you never need it or that people
1.
You are using the wrong method. If you want the query always you call it
you should use #load
2.
Using #load you will know exactly when the query is done
3.
#sum with block is not recommended since it will load all the object in
memory. This is why it was
I did some review in the code and in a relation, `#load` checks for
`loaded?` so if the relation is still loaded it will not do the query. The
only way right now to reload a relation is using `#reload`.
Rafael Mendonça França
http://twitter.com/rafaelfranca
https://github.com/rafaelfranca
On
On Feb 27, 2013, at 4:42 AM, Will Bryant wrote:
Hi guys,
I don't think that the changes made to the behavior of #all in 4.0 are a very
good idea.
I can see that you no longer need to call all in as many cases as you did
before - that's fine, just don't call it if you don't want it.
I think Rafael has already answered your questions, but as the person
who made the changes I'm happy to answer any further questions if you
have them?
On 27/02/13 13:31, Rafael Mendonça França wrote:
I did some review in the code and in a relation, `#load` checks for
`loaded?` so if the
On 28/02/2013, at 11:17 , Jon Leighton j...@jonathanleighton.com wrote:
#reload will always run the query.
If I'm misunderstanding the use case please provide some examples.
Hmm. But you can't run reload on a scope to get an array - it returns a
relation, which as per previous emails
Or all(true)
On Wed, Feb 27, 2013 at 4:25 PM, Will Bryant will.bry...@gmail.com wrote:
On 28/02/2013, at 11:17 , Jon Leighton j...@jonathanleighton.com wrote:
#reload will always run the query.
If I'm misunderstanding the use case please provide some examples.
Hmm. But you can't run
Most other enterprise-y languages (esp. Java+Hibernate, .NET+NHibernate,
.NET+Entity Framework) reinforce deferred execution of queries: the query
is not executed until it is enumerated. This is now the exact same behavior
as those platforms.
Calling .sum() on an association, before you've
Hi Jarrett,
As per previous emails, the problem is that you can't now force it to do a
query using any particular method. Associations will cache if you enumerate
them and so will not behave in that simple way.
Yes we have tests and yes it does show that this kind of change breaks things.
http://edgeguides.rubyonrails.org/association_basics.html#controlling-caching
It looks like clearing the cache and going to the DB is quite easy. I don't
believe your statement is accurate that you can't force a fresh, enumerated
query. And the cache is reset per request, which is a very short
The thing that's got worse is having to write different code for associations
vs. relations. Currently #all will behave exactly the same way on both, which
is very useful because you can write code on a model class that works the same
way whether it's working on a global scope or just an
15 matches
Mail list logo