Dave Aronson wrote: > On Mon, Aug 2, 2010 at 10:58, Marnen Laibow-Koser <[email protected]> > wrote: >> Dave, I mostly second your advice here, but there are a couple of things >> that I disagree with. > ... >> any *more* logic than this in the view is >> inappropriate, but I think testing the value of a simple method call in >> the view is OK. > > Fair enough. One needn't be a purist. I was just trying to point the > OP to the right path, even if he can stray from it.
I don't think this is a question of purism. I think that it's not impure MVC to check a boolean flag in the view -- in fact, I think that's exactly what an MVC-style view should be doing. Do you disagree? > >>> IMHO using something like: > ... >>> @activated_msg = 'This is active' if @my_object.active? >>> >>> in the controller, and then using @activated_msg in the view, would be >>> cleaner. >> >> Probably not. �I tend to believe that it's a mistake to put display text >> in the controller in most cases. > > Hmmmm. Now that I think about that, you're probably right, it would > more properly belong in the view. But before making a habit of it, > I'd like to give it some more thought. What arguments (other than MVC > purity) can you (or anyone else) come up with for either side? On the > controller-side, it means fewer decisions being made in the view, but > IMHO that's a pretty weak argument. Actually, that's a pretty strong argument. MVC purity rules all in some sense. But I also like not having to deal with I18N in the controller, and I like knowing that the view does (essentially) all the rendering of anything visible. The controller should deal with logic flow, not display details (view) or logic implementation (model). > >>�If it were any more complicated than >> this, though, I'd set a flag in the model or controller so that a simple >> boolean value could be tested in the view. > > Yes, that's sort of the main point I was getting at before. Looking > at the object's activation state, goes in the controller. It doesn't need to. If the model already has a simple active? flag on it, there's no reason for the controller to touch it. > Passing in > a simple @object_active? boolean, though, could be perfectly fair game > for the view. Right. > >> I don't know that I'd agree. �Haml (not HAML!) works basically like HTML >> (and therefore ERb [not ERB!]) with less typing. �I see no particular >> reason to use ERb when Haml is available. > > Use, perhaps not. Be familiar with, yes, so he can read a lot more > examples. True. > Sorry about the "CaseS BeIng WRoNG", I'm still somewhat of > a RubyNuby myself, so some of these things aren't quite in my fingers' > muscle memory yet! Understood! :D > >> The problem is that every MVC framework has a different >> interpretation of what MVC is. > > Ah, well, that's the great thing about standards, innit? So many to > choose from.... ;-) MVC isn't a standard. It's a philosophy, and perhaps a "metapattern", that's been differently interpreted over the years. The usual understanding of it today -- at least among Rails developers -- seems to be quite perverted from what Trygve Reenskaug originally defined. > >> And no longer mine. �ESR does explain -- mostly -- how to ask smart >> questions, but spends IMHO far too much time saying "look, we don't care >> about being nice or helpful. �Don't expect civility or help when you ask >> questions. �Just fuck off and hope the gurus throw you a bone." �That's >> not how I want the communities I'm part of to work. > > That's just esr being esr. I s'pose it comes off that way to people > not used to him. I don't care how big his name is. If he's giving mean-spirited advice, I'm going to call him on it. (For the record, I don't think it is just "ESR being ESR". I find many of his other articles quite well written and useful. I think it's a guru thinking that it's all right to be uncivil if you know enough -- an opinion I do not really subscribe to.) > If you can get past that stuff, and follow the basic > advice, it's quite useful. Parts of it, yes. I find the "you are a poor supplicant who must hope the gurus throw you a bone" attitude very *unuseful* indeed. " I paraphrased it in a blog post once as: > > * Try to solve it yourself first. The essay details several > information sources to try. > > * Ask the right person or group. > > * Communicate well, including: > o Use correct grammar, spelling, punctuation, etc.; don't > m4Ke 7h33 07h4R P3r51n 5p3Nd 4 !07 uv h1z 7yM3 f!9uR1nG oU7 wU7 u > m33N! > o Get to the point. Preferably as early as the Subject line, > if asking by email. > o Be specific about the problem or question, and what kind > of help you're looking for. > o Give all the data you have. > o But still be concise. > > * Say what you already tried, and why that didn't satisfy you. Yes, those are among the points I agree with. > > * Above all, be nice about it! I agree with that too. A pity he doesn't follow his own advice. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

