I'm doing maintenance work on a Rails site that has been deployed using Phusion Passenger . The workflow is slightly different from the standard three-level Railsian testing method-dev-production; instead, there are two separate installations of the same code base, working with parallel Oracle databases; the dev website is on qa.domain.com and the website is at www.domain.com
I experience a different behavior in the following code fragment (from 'vendors_controller.rb' that uses AuthenticatedSystem) between two environments:
def create @user = current_user || User.new(params[:user]) @registration = Registration.new(params[:registration]) unless current_user @user.user_type = 'vendor' @user.active = 1 if @user.save @user.activate! @user.has_role 'owner', @user @user.has_role 'vendor' self.current_user = user = @user @registration.active = 1 @registration.email = @user.email @registration.user_id = @user.id if @registration.save send_confirmation(@user) send_solicitations_notifications(@registration) if @registration.notification_desired == true redirect_to thank_you_vendors_path else
The code between the comments destroys the user object that was just created if the system was unable to create the corresponding registration. It works fine on the development server, but not on the production server, where the User object stubbornly hangs around the database, even if the registration is not saved. Pushing changes during production is a simple matter of downloading the controller file and executing touch tmp/restart.txt through the shell. Otherwise, the two codes are identical; what can cause this difference?
Thank you for your attention!
Justin
EDIT: There are several differences in production.rb from two installations that can help diagnose the problem. In production
config.cache_classes = true # Full error reports are disabled and caching is turned on config.action_controller.consider_all_requests_local = false config.action_controller.perform_caching = true
and in development, these three flags are set to their inverse values. Thanks!
source share