I have the following code in a controller with an AcitveResource base
class in Farm and Server which working perfectly in development mode
but not in production.  It seems some caching mechanism make it broken
and I need some help to solve it.

Firstly, the controller passes {"farm_id"=>"473170433"} to params.

In order to allow Server changes its site according to the farm_id,
then in controller, I add:

Server.site += "/farms/#{params[:farm_id]}"

Then get the farm item
@farm = Farm.find(params[:farm_id])

Now inspecting @farm.id, it is 473170433.

@server = Server.create(:farm_id => @farm.id)

Inspecting @server

#<Server:0xb70891a4
  @attributes={
    "updated_at"=>Wed Oct 29 02:46:18 UTC 2008,
    "farm_id"=>473170434,
     ^^^^^^^^^^^^^^^^^^^^^^^^^^
    "id"=>996332954,
    "created_at"=>Wed Oct 29 02:46:18 UTC 2008},
  @prefix_options={}>

Notice it the farm_id is 473170434, not the one (473170433) assigned
in the create call. 473170434 is the farm_id parameter in the first
create call after server restart.  The code breaks in production
mode.  How can I fix it so that Server can read the farm_id correctly?

Any help is appreciated.

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