Does ActiveRecord run different queries during production?

My class hierarchy looks like this:

class Post < ActiveRecord::Base; end
class Project < Post; end
class ProjectDesignWall < Project; end

There is a controller that retrieves such data:

@projects = Project.find(:all, :include => [:project_image_photos,:user])

The developmentfollowing query is executed, directly from the logs:

SELECT * FROM `posts` WHERE ( (`posts`.`type` = 'Project' ) ) ORDER BY originally_created_at DESC

However, as soon as it starts in mode production, even with the same database and data, this leads to the following query:

SELECT * FROM `posts` WHERE ( (`posts`.`type` = 'Project' OR `posts`.`type` = 'ProjectDesignWall' ) ) ORDER BY originally_created_at DESC

Does anyone know why this is happening, and is there a way to make it at least behave consistently if not fix the problem?

+3
source share

Source: https://habr.com/ru/post/1705692/


All Articles