Well, I discovered the proximate cause why effective_date is not set, 
but I do not know why this is happening.

      field_array.each do |f|
        #puts parm_hash[f].class
        f = f.to_sym
        puts "have #{f}"    if model.attribute_present?(f)
        puts "missing #{f}" unless model.attribute_present?(f)
        model.send("#{f}=", "#{parm_hash[f]}") if 
model.attribute_present?(f)
      end

gives:

missing effective_from
have client_credit_limit
have client_credit_policy
have client_credit_status
have client_credit_terms
missing superseded_after

So, why would the model report the attribute as missing?  The view for 
this looks like this:


      <%= f.text_field  :effective_from,
                        :size => 12,
                        :class => 'datebalks'
      -%>

      <%= f.text_field  :superseded_after,
                        :size => 12,
                        :class => 'datebalks'
      -%>

annotate gives this:
# == Schema Information
# Schema version: 20090312200034
#
# Table name: clients
#
#  id                   :integer         not null, primary key
#  entity_id            :integer         not null
#  client_credit_limit  :integer         default(0), not null
#  client_credit_policy :string(4)       default("CASH"), not null
#  client_credit_status :string(4)       default("HOLD"), not null
#  client_credit_terms  :integer         default(0), not null
#  effective_from       :datetime
#  superseded_after     :datetime
#  changed_at           :datetime
#  changed_by           :string(255)
#  created_at           :datetime        not null
#  created_by           :string(255)
#  lock_version         :integer         default(0), not null
#

and the attribute is self-evidently present because this code:

      field_array.each do |f|
        #puts parm_hash[f].class
        f = f.to_sym
        puts "have #{f}"    if model.attribute_present?(f)
        puts "missing #{f}" unless model.attribute_present?(f)
        model.send("#{f}=", "#{parm_hash[f]}") if 
model.attribute_present?(f)
      end
      puts model.id
      puts model.effective_from
      puts model.does_not_exist
      return model

Fails here:
      undefined method `does_not_exist' for #<Client:0x2b917dbb34a8>

and not on:
      puts model.effective_from

Any ides as to what is going on?
-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to