On 27 Jan 2009, at 06:43, hema gonaboina wrote:

> Hi All,
>
>    I am new to ruby on rails,we are developing a integrated  
> application which can be accessed by many companies..
>
>    We developed application on development environment,recently we  
> switched to production environment as per client request.The  
> insertion operation working fine where are the updation not working...
>
>    Updation working for sometimes if it is done consecutively then  
> it is not working,If the server restart it is working again upto  
> some requests..
>
> My Code is

What is this - a controller action or something else ? It seems to be  
insanely circular - creating a record from parameters so that you can  
serialize it to xml and then deserialize it to get a hash of  
attributes - really ?! SOmne of the code doesn't even look like legal  
ruby to me

Fred
>
>  def UpdateToDB
>
>         hash = params[:object].to_hash
>         key = hash['key']
>
>          if key==nil then                                       #  
> since the operation is generic
>                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
>
>
>
>                The above method working fine for updation upto some  
> requests only.. like 8 updates not more than.. for the 9th update  
> the statement record.to_xml showing the updated value in the server  
> but it is not get updated in the database..
>
>  Can anyone solve my problem and save my day...
>  Thanks
>
> >


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