Loading...

WellRailed@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [WellRailed] A question of style Andy Newport Thu Feb 02 16:10:30 2012

Answers to this question won't help with your underlying issue, it usually
means you haven't got your relations modeled correctly re. things like
validates_associated and inverse_of.

Got a more solid example?

On Wed, Jan 25, 2012 at 10:40 AM, Henry Maddocks
<[EMAIL PROTECTED]>wrote:

> Ignore the class and method names, it's just the first thing that entered
> my head.
>
> On 25/01/2012, at 10:06 AM, Philip Murray wrote:
> >
> >
> > I sometimes provide both, and the method with a bang does the save for
> you
> >
> > Then you can have the choice, if you're making other changes to your
> model before saving it
>
> I've done this in the past but it feels anti YAGNI unless you're writing a
> public api.
>
> And bang methods feel weird to me. You don't use bang when setting
> instance variables on Ruby objects. attr_accessor doesn't create bang
> methods for example. I guess the root problem is having to call save.
>
> The reason I asked is I had a situation where I was having to sprinkle
> reloads and saves all over the code to get model attribute changes to be
> picked up correctly. It wouldn't have been necessary if the models were
> saving themselves.
>
> Henry
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "WellRailed" 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/wellrailed?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"WellRailed" 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/wellrailed?hl=en.