On Mar 28, 2010, at 11:56 AM, Daniel M wrote:

:(

Does not work...

Maybe is because I have a new_for action


def new_for_fraccao
   hobo_new_for :fraccao do
      if params[:fraccao_id]
        @fraccao=Fraccao.find(:first, :conditions=> ["id
= ?",params[:fraccao_id] ])
        original = Morada.find(:first, :conditions=> ["imovel_id
= ?",@fraccao.imovel_id])
        this = @morada= original.clone
      else
        @morada.attributes = params[:morada] || {}
        hobo_ajax_response if request.xhr?
     end
   end
 end

My first guess would be that cloning 'original' is messing up the logic that detects where to send the form data to - the object won't have new_record? set, for instance. You'll probably want to grab the object already in 'this' (set up by hobo_new_for) and fill in any parameters that you need.

HOWEVER, in this case it seems like there's a code smell here; typical DB normalization rules mean there shouldn't *be* any data to copy in this situation. Can you provide more detail on your models?

Thanks,

Matt Jones

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

Reply via email to