Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Why is my object.save working in one place and failing in another?
- require 'rubygems'
- require 'mysql2'
- @inverters=Inverter.where(:mac=>@mac)
- Inverter.transaction do
- @inverters.each do |inverter|
- inverter.ip = @client_ip
- inverter.save # Object is saved:)!
- end
- end
- require 'rubygems'
- require 'mysql2'
- @outputs=<a two dimensional hash>
- Output.transaction do
- @outputs.each do |out|
- @newOut = Output.new
- @newOut.inverter_id = out[:inverter_id]
- @newOut.eac = out[:eac]
- @newOut.pac = out[:pac]
- @newOut.vac = out[:vac]
- @newOut.iac = out[:iac]
- @newOut.epv = out[:epv]
- @newOut.ppv = out[:ppv]
- @newOut.vpv = out[:vpv]
- @newOut.save # Object fails to save to db:(.
- # 2 lines of other code
- end
- end
Add Comment
Please, Sign In to add comment