Michael Schuerig wrote:
> On Friday 03 September 2010, Marnen Laibow-Koser wrote:
>> > end
>>
>[...]
>> model, all your Article data fields are really in the Version object.
>> That's cumbersome, as you're finding out.
>
> The data model expresses what I need.
Maybe not. If you're finding it this difficult to use, I wonder.
> Versions of the same article can
> have different titles. It is likely that an older version of an article
> is already published whereas the latest version is still in draft state.
That doesn't really invalidate my earlier suggestion, I think, or at
least a modification of it.
>
>> Not if you had done Article.all :joins => :versions in the first
>> place.
>
> :joins with a symbol does an inner join.
So use an SQL fragment if you need an outer join (which, on reflection,
I suppose you do).
> When there are several draft
> versions, which one would I get? Answer: any. I want a specific one: the
> latest.
You can specify conditions and sort order on fields from joined tables.
That should do the trick.
>
>> > Now, I know how to deal with this in SQL, with either a correlated
>> > sub- select or an even more complicated left outer join.
>>
>> No way! A simple join should do it. Why do you think you need
>> anything more complex?
>
> Before you claim that I'm wrong, please consider the possibility that
> you don't understand what I'm trying to do. Thank you.
I did consider that possibility. If you think I'm misunderstanding you,
please tell me what I got wrong.
>
>> Stop overthinking. Stop fighting Rails. Stop trying to use such a
>> poor data model.
>
> Stop being overly confident of your opinion when you don't understand
> the situation. If you think my problem statement was not precise enough,
> you could have asked for the details you thought were missing.
Your problem statement was plenty precise -- precise enough for me to
determine that you may have a modeling problem.
Now, if you think there's something I don't understand, please tell me
what it is and I'll modify my suggestions accordingly.
> No need
> to start out with bold and unwarranted statements.
I don't believe anything I said was unwarranted. You came here looking
for advice, right? I gave you the best advice I know how to. You may
not like it, but please don't just make nebulous "you don't understand"
statements without saying what you think I missed. The best advice is
not always the advice you wanted to hear.
>
> Michael
>
> --
> Michael Schuerig
> mailto:michael@schuerig.de
> http://www.schuerig.de/michael/
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
Sent from my iPhone
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment