Ok, I'm sold. I'll update each model's to_s method to respond with
the "title" that I want displayed in the partial. Thanks again for
your input.
On Feb 28, 8:31 am, Maurício Linhares
wrote:
> On Sat, Feb 28, 2009 at 10:02 AM, ericindc wrote:
> > Makes sense for consistency's sake. My initia
On Sat, Feb 28, 2009 at 10:02 AM, ericindc wrote:
> Makes sense for consistency's sake. My initial concern is about
> overriding a core method. What if I needed to_s elsewhere?
Usually, you shouldn't need it unless what you need is a "string
representation of your object" (yes, i'm sounding li
Thanks for both posts regarding DRY and too DRY. Some very good
points.
On Feb 28, 7:08 am, Maurício Linhares
wrote:
> On Sat, Feb 28, 2009 at 1:32 AM, ericindc wrote:
>
> > Ok, I follow having all models respond to "title", but why would
> > implementing the model's "to_s" method be a better
On Sat, Feb 28, 2009 at 1:32 AM, ericindc wrote:
>
> Ok, I follow having all models respond to "title", but why would
> implementing the model's "to_s" method be a better approach? Is it
> just for consistency, always expecting to_s to return what the partial
> should display? How is that any d
* ericindc [2009-02-27 18:20:27 -0800]:
>
> I'm working on fixing up the code in my first Rails application and
> have come around to DRYing up the views and partials. For the most
> part, I'm satisfied with the DRYness of the application, but I have
> 5-6 partials that display nearly identical
ericindc wrote:
> I'm working on fixing up the code in my first Rails application and
> have come around to DRYing up the views and partials. For the most
> part, I'm satisfied with the DRYness of the application, but I have
> 5-6 partials that display nearly identical XHTML, just with different
Ok, I follow having all models respond to "title", but why would
implementing the model's "to_s" method be a better approach? Is it
just for consistency, always expecting to_s to return what the partial
should display? How is that any different that expecting all models
to answer to title?
Than
On Fri, Feb 27, 2009 at 11:50 PM, ericindc wrote:
>
> And what about cases where I need the model attribute names to be
> different? For instance, in one case I might print item.name, but in
> the other, item.title.
Make all models that are going to be used by that template respond to
the same
And what about cases where I need the model attribute names to be
different? For instance, in one case I might print item.name, but in
the other, item.title. And since this markup will be similar to the
front-end display (non-admin), is there a good way to set the link_to
to be either :admin or
Thanks, I'll work through your example.
I'm not sure that I follow your second comment. I understand that
having duplicate markup is not desirable, but is there another way I
should be approaching this?
On Feb 27, 9:35 pm, Maurício Linhares
wrote:
> Here's how it could look like ->http://pasti
Here's how it could look like -> http://pastie.org/402767
And having five pages with almost the same markup is always wrong, you
don't even need to be looking for DRYing up your code.
-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
On Sat, Feb 28
11 matches
Mail list logo