On 7 February 2011 21:06, James Byrne <[email protected]> wrote:
> Q.  What am I doing wrong such that tx_batch_mtime is not receiving the
> value I believe that I am assigning?  At this point current_entry has
> not itself been saved.
>
> I have this code:
>
> puts( "***      ***" *3 )
>
>      current_log_entry = current_entry.edi_log_entries.build
>
> puts( current_log_entry.class )
> puts( hash[:current_batch][:tx_batch_mtime] )
>
>      current_log_entry.tx_batch_mtime = \   # linebreak for clarity

The \ must be the last char on the line, though I would have expected
this to generate a compile error.

If still not working use ruby-debug to break into the code and inspect
data to see what is going on.  See Rails Guide on debugging if unsure
how to do this.  I is often a lot easier than loads of debug o/p.

Colin

>        hash[:current_batch][:tx_batch_mtime]
>
> puts( current_log_entry.to_yaml )
> puts( current_entry.cctn )
> puts()
>
> Which produces this output:
>
>      ***      ******      ******      ***
>      CaCustomsEdiLogEntry
>      1276181402
>      --- !ruby/object:CaCustomsEdiLogEntry
>      attributes:
>        tx_batch_number:
>        created_at:
>        changed_by: " "
>        tx_message_function:
>        tx_record_type:
>        tx_batch_date:
>        lock_version: 0
>        tx_batch_account:
>        created_by: " "
>        accessed_at:
>        tx_batch_mtime:
>        tx_message_data:
>        changed_at:
>        accessed_from: " "
>        ca_customs_entry_id:
>        accessed_by: " "
>      attributes_cache: {}
>
>      changed_attributes: {}
>
>      destroyed: false
>      marked_for_destruction: false
>      persisted: false
>      previously_changed: {}
>
>      readonly: false
>      13466600016294
>
>      1276181402
>      20100610
>      13466
>      009
>
> As you can see, current_edi_log.tx_batch_mtime is nil whereas I expect
> it to be 1276181402.  Why?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to