Giter VIP home page Giter VIP logo

activerecord-deprecated_finders's Introduction

Active Record Deprecated Finders

This gem is a dependency of Rails 4.0 to provide deprecated finder functionality.

It will be removed as a dependency in Rails 4.1, but users can manually include it in their Gemfile and it will continue to be maintained until Rails 5.

gem 'activerecord-deprecated_finders', require: 'active_record/deprecated_finders'

This gem is used to extract and deprecate old-style finder option hashes in Active Record:

Post.find(:all, conditions: { published_on: 2.weeks.ago }, limit: 5)

as well as the following dynamic finders:

  • find_all_by_...
  • find_last_by_...
  • scoped_by_...
  • find_or_initialize_by_...
  • find_or_create_by_...

Note that find(primary_key), find_by..., and find_by...! are not deprecated.

To avoid reliance on this gem, you'll need to migrate your finder usage.

To migrate dynamic finders to Rails 4.1+:

  • find_all_by_... should become where(...).
  • find_last_by_... should become where(...).last.
  • scoped_by_... should become where(...).
  • find_or_initialize_by_... should become find_or_initialize_by(...).
  • find_or_create_by_... should become find_or_create_by(...).

To migrate old-style finder option hashes and for additional information, please refer to:

activerecord-deprecated_finders's People

Contributors

codeodor avatar garysweaver avatar jonleighton avatar markmcspadden avatar matthewd avatar miry avatar nerian avatar rafaelfranca avatar senny avatar stopdropandrew avatar tenderlove avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.