Skip to content

Instantly share code, notes, and snippets.

@malandrina
Last active August 29, 2015 13:56
Show Gist options
  • Save malandrina/9237572 to your computer and use it in GitHub Desktop.
Save malandrina/9237572 to your computer and use it in GitHub Desktop.
HotelTonight Rails 4 Deprecation Warnings
DEPRECATION WARNING: It looks like you are eager loading table(s) (one of: agents, hoteltonight) that are referenced in a string SQL snippet. For example:
Post.includes(:comments).where("comments.title = 'foo'")
Currently, Active Record recognizes the table in the string, and knows to JOIN the comments table to the query, rather than loading comments in a separate query. However, doing this without writing a full-blown SQL parser is inherently flawed. Since we don't want to write an SQL parser, we are removing this functionality. From now on, you must explicitly tell Active Record when you are referencing a table from a string:
Post.includes(:comments).where("comments.title = 'foo'").references(:comments)
If you don't rely on implicit join references you can disable the feature entirely by setting `config.active_record.disable_implicit_join_references = true`. (called from _app_views_agents_index_html_haml__860689087346826956_70228045189400 at /Users/training/Source/thoughtbot/hotelstonight/app/views/agents/index.html.haml:20)
DEPRECATION WARNING: #connection is deprecated in favour of accessing it via the class. (called from block (3 levels) in <top (required)> at /Users/training/Source/thoughtbot/hotelstonight/spec/models/booking_spec.rb:589)
DEPRECATION WARNING: Relation#calculate with finder options is deprecated. Please build a scope and then call calculate on it instead. (called from remove_booked_in_multinight_prior at /Users/training/Source/thoughtbot/hotelstonight/app/models/room.rb:742)
DEPRECATION WARNING: It looks like you are eager loading table(s) (one of: room_night_charges, bookings) that are referenced in a string SQL snippet. For example:
Post.includes(:comments).where("comments.title = 'foo'")
Currently, Active Record recognizes the table in the string, and knows to JOIN the comments table to the query, rather than loading comments in a separate query. However, doing this without writing a full-blown SQL parser is inherently flawed. Since we don't want to write an SQL parser, we are removing this functionality. From now on, you must explicitly tell Active Record when you are referencing a table from a string:
Post.includes(:comments).where("comments.title = 'foo'").references(:comments)
If you don't rely on implicit join references you can disable the feature entirely by setting `config.active_record.disable_implicit_join_references = true`. (called from remove_booked_in_multinight_prior at /Users/training/Source/thoughtbot/hotelstonight/app/models/room.rb:742)
DEPRECATION WARNING: The :distinct option for `Relation#count` is deprecated. Please use `Relation#distinct` instead. (eg. `relation.distinct.count`). (called from remove_booked_in_multinight_prior at /Users/training/Source/thoughtbot/hotelstonight/app/models/room.rb:742)
DEPRECATION WARNING: It looks like you are eager loading table(s) (one of: bookings, rooms) that are referenced in a string SQL snippet. For example:
Post.includes(:comments).where("comments.title = 'foo'")
Currently, Active Record recognizes the table in the string, and knows to JOIN the comments table to the query, rather than loading comments in a separate query. However, doing this without writing a full-blown SQL parser is inherently flawed. Since we don't want to write an SQL parser, we are removing this functionality. From now on, you must explicitly tell Active Record when you are referencing a table from a string:
Post.includes(:comments).where("comments.title = 'foo'").references(:comments)
If you don't rely on implicit join references you can disable the feature entirely by setting `config.active_record.disable_implicit_join_references = true`. (called from less_than_x_bookings_triggered_by? at /Users/training/Source/thoughtbot/hotelstonight/app/models/hotel_calling_trigger.rb:64)
DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. `Post.where(published: true).load`). If you want to get an array of records from a relation, you can call #to_a (e.g. `Post.where(published: true).to_a`). (called from block (3 levels) in <top (required)> at /Users/training/Source/thoughtbot/hotelstonight/spec/models/market_city_spec.rb:364)
DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. `Post.where(published: true).load`). If you want to get an array of records from a relation, you can call #to_a (e.g. `Post.where(published: true).to_a`). (called from block (3 levels) in <top (required)> at /Users/training/Source/thoughtbot/hotelstonight/spec/models/market_city_spec.rb:368)
DEPRECATION WARNING: Date#to_time_in_current_zone is deprecated. Use Date#in_time_zone instead. (called from block in past_cutoff_time? at /Users/training/Source/thoughtbot/hotelstonight/app/models/hotel.rb:431)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment