Yes, the "auto-save" rules of ActiveRecord are one definite drawback of 
ActiveRecord.

The rules are here: 
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html 
(scroll down to Unsaved objects and associations)

You might be able to use:

@report.build_parameter

The best way to avoid this, if possible, is to switch from has_one to 
belongs_to.

cheers,
Bryan


Venka Ashtakala wrote:
> Hello all,
> I have 2 models and they are associated as " Report has_one Parameter "
> 
> so in my controller show action i have the following code:
> 
> reports_controller
> def show
> hobo_show
> @report.parameter = Parameter.new
> end
> 
> When the '@report.parameter = Parameter.new' is being called, the record 
> is being inserted into the db, is there any way to disable the insert so 
> that it is just done in application memory?
> 
> Thanks
> Venka
> 
> -- 
> Venka Ashtakala, B.Eng, G.C. Eng
> Venka Ashtakala & Associates
> Software Development Consultants
> Office:  +1-703-596-0287
> Fax:     +1-815-550-1356
> Mobile: +91 9886304317
> [email protected] <mailto:[email protected]>
> 
> 
> 
> > 


--~--~---------~--~----~------------~-------~--~----~
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