On Oct 29, 3:24 am, Omnibus
<omnibus.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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.
>
It''s slightly hard to say without seeing the exact code, but
it''s
important to know that in production mode code is never reloaded,
whereas in development mode it is reloaded between requests.
Fred> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---