update_attributes not working on production environment

Hi,

 Here is my Sample Code... I am calling the genericCURDoperation action through the view and sending the xml containing the record to be inserted/updated along with its key value(the primary key field and it's value in the xml)

The controller action is

def genericCURDoperation

companyid = session[:companyid]

    obj = MGenericCurdOperation.new(params[:objects],companyid)

    result = obj.genericAction

    puts result 

end

In my MGenericCurdOperation model

class MGenericCurdOperation

  attr_accessor :companyid,:objects

def intialize(xml,companyid)

                 @objects = xml      

                 @companyid = companyid   

        end   

       def genericAction       

                  hash = @objects.to_hash       

                  operation = hash['operation']

       if operation == "insert" then

             status = saveToDB(hash['record'],companyid)

                  elsif operation == "update" then

              status = UpdateToDB(hash['record'],companyid)

               .................      

                 end       

                 return status   

        end   

        def saveToDB(record,companyid)

                      ............  

        end   

        def UpdateToDB(record,companyid)

 hash = record.to_hash

     key = hash['key']

if key==nil then

       puts " the key not coming thourgh xml"

                          return nil

   end

value = hash[key.to_s]

model = hash['model']

record = model.find(:all,:conditions=>["#{key}=?",value]) #retriving the record from db

updateRecord = model.new(hash['record']) # record with updated fileds ,consits every filed in the record except the key value,attribute

 updateRecord.TimeUpdate = DateTime.now # Here whatever the other requirements and conversions added to the     updateRecord and also checking the required fields to be non empty etc;

   recordHash = Hash.from_xml(updateRecord.to_xml)

   root = recordHash.keys

       rootElement = root(0)

     if record.update_attributes(recordHash[rootElement.to_s]) then

                        puts record.to_xml

                        puts "saved successfully"

                        redirect_to 'index'

     end

end

end

this is my code with some more operations also.When I debug the control going to the update_attributes but it is not updating in database.even the record.to_xml showing the contents as updated but in can’t be viewed in database and also on index page. Can anyone please help me due to this my application not working and can’t be moved to the production.

Hi,

     Here is my Sample Code... I am calling the genericCURDoperation
action through the view and sending the xml containing the record to
be inserted/updated along with its key value(the primary key field
and it's value in the xml)

this is my code with some more operations also.When I debug the
control going to the update_attributes but it is not updating in
database.even the record.to_xml showing the contents as updated but
in can't be viewed in database and also on index page. Can anyone
please help me due to this my application not working and can't be
moved to the production.

Does your ActiveRecord model have method/associations called
transaction or changed ? (PS it's CRUD not CURD)

Fred

What orm are you using?

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

Julian Leviston wrote:

What orm are you using?

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

Hi,
   In my active record I am not having any associations with the name
trasaction or changed.
    But,In my environment.rb I specified my rails version as 2.1.0 but
it is using the activerecord-2.2.2.I am using netbeans IDE for
development,and I am using mysql for the database and ActiveRecord::Base
for the connections.

Hi, do you have a version of rails in the vendor directory of your Rails application?

-Conrad

Your model didn't appear to inherit from active record base.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

Hi,

  Where I have to check in vendor directory

  I have the plugins directory only containing
  1. validates_date_and_time
  2. restful_authentication
  3. rubyamf

I uninstalled rails 2.2.2 in my associations folder of activerecord
2.1.0 there is no method like transfer/change any one please help me..
I am unable to proceed furthur