I would always go for A
def commified_name
#{self.firstname} #{self.last_name}
end
It keeps the formatting in one place, no need for an additional helper
method or indeed a helper class. I'd only really use a helper method to
encapsulate repeated code in views. Just suppose you wanted to
Thanks for the reply.
I'd only really use a helper method to encapsulate repeated code in
views.
But isn't that the case here? I repeatedly use the commified version
of the name inside of my views. So why wouldn't C be the best
solution? Wouldn't using A break that convention?
I also use the
Oops, I meant A (in the Model) is the best answer, not C.
On Jan 31, 9:42 am, ericindc ericmilf...@gmail.com wrote:
Thanks for the reply.
I'd only really use a helper method to encapsulate repeated code in
views.
But isn't that the case here? I repeatedly use the commified version
of the
Hi there,
Ok that statement was probably a bit ambiguous. I'd use a view helper to
encapsulate something that is purely view based. I'd say that
commified_name isn't confined to the view, its legitimately an attribute
of the model - model attributes aren't confined to database attributes.
I
Generally I would go with whatever solution feels more natural, and
easier to manage for you. Don't get bogged down in convention if it
doesn't work for you or feels wrong.
I prefer to say that like: Put the code where it's easiest to test.
Models are easier to test than controllers, so
Agreed its easier to test models, or at least I find it easier. I'd say
that its a fortunate side effect though, rather than a reason to test in
a certain way. Although I guess if it really is too hard to test any
part of your app then you're probably trying to solve the problem in the
wrong
Thanks for the replies, fellas. I've moved the code into my Model.
Thanks again.
On Jan 31, 11:33 am, Rob Lacey r...@mail.pigdestroyer.co.uk wrote:
Agreed its easier to test models, or at least I find it easier. I'd say
that its a fortunate side effect though, rather than a reason to test in
On Friday 30 January 2009 09:31 pm, ericindc wrote:
commified_name
Off the point, but before we allow a word like commified to escape into
the wild (see usage in next post by Rob Lacey), we spell it commafied
instead--there is a slightly greater chance of guessing its intended
meaning.
On Sat, Jan 31, 2009 at 10:06 AM, Randy Kramer rhkra...@gmail.com wrote:
Off the point, but before we allow a word like commified to escape into
the wild (see usage in next post by Rob Lacey), we spell it commafied
instead--there is a slightly greater chance of guessing its intended
meaning.
9 matches
Mail list logo