thanks Jacques and Alex.
both these lightweight examples are interesting.
I keep thinking I'm closing in on the right set of patterns.

Jon


On Dec 5, 10:40 pm, Alex Neth <[EMAIL PROTECTED]> wrote:
> On Dec 5, 4:12 pm, Jacques Crocker <[EMAIL PROTECTED]> wrote:
>
>
>
> > Here's my current simple solution:
>
> > Monkey with Hash:http://gist.github.com/32279
>
> > Then I explicitly specify which fields I want to save in my controller
> > action:
>
> > def update(id)
> >   @person = Person.get(id)
> >   @person.attributes = params[:person].choose(:name, :email)
> >   if @person.save
> >     redirect resource(@person)
> >   else
> >     render :edit
> >   end
> > end
>
> Not sure about monkeying with Nil, but it's a nice lightweight
> solution.
>
> Agreed that Object.create(params[:object]) is frightening.  I
> shuddered the first time I saw it in Rails, then got a bit too used to
> it.  Another less intrusive method:
>
>  def update(id, person)
>   [EMAIL PROTECTED] = Person.get(id)
>   [EMAIL PROTECTED]({:name, :email}.each{|k|person[k]})
> ...
>
> A bit strange having a variable called person that is really a hash,
> but doesn't seem to be a way to rename that....
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to