Code Monkey home page Code Monkey logo

activerecord-deprecated_finders's Introduction

Welcome to Rails

What's Rails?

Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

Understanding the MVC pattern is key to understanding Rails. MVC divides your application into three layers: Model, View, and Controller, each with a specific responsibility.

Model layer

The Model layer represents the domain model (such as Account, Product, Person, Post, etc.) and encapsulates the business logic specific to your application. In Rails, database-backed model classes are derived from ActiveRecord::Base. Active Record allows you to present the data from database rows as objects and embellish these data objects with business logic methods. Although most Rails models are backed by a database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as provided by the Active Model module.

View layer

The View layer is composed of "templates" that are responsible for providing appropriate representations of your application's resources. Templates can come in a variety of formats, but most view templates are HTML with embedded Ruby code (ERB files). Views are typically rendered to generate a controller response or to generate the body of an email. In Rails, View generation is handled by Action View.

Controller layer

The Controller layer is responsible for handling incoming HTTP requests and providing a suitable response. Usually, this means returning HTML, but Rails controllers can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and manipulate models, and render view templates in order to generate the appropriate HTTP response. In Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and controller classes are derived from ActionController::Base. Action Dispatch and Action Controller are bundled together in Action Pack.

Frameworks and libraries

Active Record, Active Model, Action Pack, and Action View can each be used independently outside Rails.

In addition to that, Rails also comes with:

  • Action Mailer, a library to generate and send emails
  • Action Mailbox, a library to receive emails within a Rails application
  • Active Job, a framework for declaring jobs and making them run on a variety of queuing backends
  • Action Cable, a framework to integrate WebSockets with a Rails application
  • Active Storage, a library to attach cloud and local files to Rails applications
  • Action Text, a library to handle rich text content
  • Active Support, a collection of utility classes and standard library extensions that are useful for Rails, and may also be used independently outside Rails

Getting Started

  1. Install Rails at the command prompt if you haven't yet:

    $ gem install rails
  2. At the command prompt, create a new Rails application:

    $ rails new myapp

    where "myapp" is the application name.

  3. Change directory to myapp and start the web server:

    $ cd myapp
    $ bin/rails server

    Run with --help or -h for options.

  4. Go to http://localhost:3000 and you'll see the Rails bootscreen with your Rails and Ruby versions.

  5. Follow the guidelines to start developing your application. You may find the following resources handy:

Contributing

We encourage you to contribute to Ruby on Rails! Please check out the Contributing to Ruby on Rails guide for guidelines about how to proceed. Join us!

Trying to report a possible security vulnerability in Rails? Please check out our security policy for guidelines about how to proceed.

Everyone interacting in Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Rails code of conduct.

License

Ruby on Rails is released under the MIT License.

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

activerecord-deprecated_finders's Issues

There is an issue in the documentation

lib/active_record_deprecated_finders/relation.rb:79

"a scope and then call find_in_batches on it instead." instead of "a scope and then call calculate on it instead."

License missing from gemspec

Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec,

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Even for projects that already specify a license, including a license in your gemspec is a good practice, since it is easily
discoverable there without having to check the readme or for a license file.

For example, there is a License Finder gem to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough
issue that even Bundler now generates gems with a default 'MIT' license.

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file),
github has created a license picker tool.

In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally
looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :).

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue and let me know. In either case, I'll follow up. Thanks!

p.s. I've written a blog post about this project

no such file to load -- active_record_deprecated_finders

Hi guys,

just a small thing:

While trying to run simply.rb from active_record/examples I received a Load Error:
custom_require.rb:55:in `require': no such file to load -- active_record_deprecated_finders (LoadError)

Cause in active_record on line 27: require 'active_record_deprecated_finders'...

cheers!

tests fail under ruby2.3

Hi,

I tried running the tests under Ruby 2.3 and they fail like this:

$ ruby -v
ruby 2.3.0p0 (2015-12-25) [x86_64-linux-gnu]
$ bundle show
Gems included by the bundle:
  * actionmailer (4.2.5.2)
  * actionpack (4.2.5.2)
  * actionview (4.2.5.2)
  * activejob (4.2.5.2)
  * activemodel (4.2.5.2)
  * activerecord (4.2.5.2)
  * activerecord-deprecated_finders (1.0.4)
  * activesupport (4.2.5.2)
  * arel (6.0.3)
  * builder (3.2.2)
  * bundler (1.11.2)
  * concurrent-ruby (1.0.1)
  * erubis (2.7.0)
  * globalid (0.3.6)
  * i18n (0.7.0)
  * json (1.8.3)
  * loofah (2.0.3)
  * mail (2.6.3)
  * mime-types (2.99.1)
  * mini_portile2 (2.0.0)
  * minitest (5.8.4)
  * nokogiri (1.6.7.2)
  * rack (1.6.4)
  * rack-test (0.6.3)
  * rails (4.2.5.2)
  * rails-deprecated_sanitizer (1.0.3)
  * rails-dom-testing (1.0.7)
  * rails-html-sanitizer (1.0.3)
  * railties (4.2.5.2)
  * rake (10.5.0)
  * sprockets (3.5.2)
  * sprockets-rails (3.0.4)
  * sqlite3 (1.3.11)
  * thor (0.19.1)
  * thread_safe (0.3.5)
  * tzinfo (1.2.2)
$ bundle exec rake
/usr/lib/ruby/vendor_ruby/debian_ruby_standalone.rb:24: warning: method redefined; discarding old user_dir
/usr/lib/ruby/2.3.0/rubygems/defaults.rb:76: warning: previous definition of user_dir was here
/usr/lib/ruby/vendor_ruby/debian_ruby_standalone_config.rb:2: warning: method redefined; discarding old ruby
/usr/lib/ruby/2.3.0/rubygems.rb:797: warning: previous definition of ruby was here
Run options: --seed 34515

# Running:

..............................E.EE..................................

Finished in 0.351114s, 193.6695 runs/s, 350.3140 assertions/s.

  1) Error:
associations#test_0007_supports proc where values which access the owner:
ArgumentError: wrong number of arguments (given 0, expected 1)
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/spawn_methods.rb:41:in `instance_exec'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/spawn_methods.rb:41:in `merge!'
    /tmp/activerecord-deprecated_finders/lib/active_record/deprecated_finders/association_builder.rb:22:in `block in to_proc'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:191:in `instance_exec'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:191:in `eval_scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:155:in `block (2 levels) in add_constraints'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:154:in `each'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:154:in `block in add_constraints'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `each'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `each_with_index'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `add_constraints'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:39:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:5:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association.rb:97:in `association_scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association.rb:86:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_association.rb:423:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_proxy.rb:37:in `initialize'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/delegation.rb:106:in `new'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/delegation.rb:106:in `create'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_association.rb:39:in `reader'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/builder/association.rb:115:in `comments'
    /tmp/activerecord-deprecated_finders/test/associations_test.rb:77:in `block (2 levels) in <top (required)>'


  2) Error:
associations#test_0005_translates hash scope options into scopes:
ArgumentError: wrong number of arguments (given 0, expected 1)
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/spawn_methods.rb:41:in `instance_exec'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/spawn_methods.rb:41:in `merge!'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/spawn_methods.rb:33:in `merge'
    /tmp/activerecord-deprecated_finders/lib/active_record/deprecated_finders/association_builder.rb:24:in `block in to_proc'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:191:in `instance_exec'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:191:in `eval_scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:155:in `block (2 levels) in add_constraints'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:154:in `each'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:154:in `block in add_constraints'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `each'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `each_with_index'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `add_constraints'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:39:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:5:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association.rb:97:in `association_scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association.rb:86:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_association.rb:423:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_proxy.rb:37:in `initialize'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/delegation.rb:106:in `new'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/delegation.rb:106:in `create'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_association.rb:39:in `reader'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/builder/association.rb:115:in `comments'
    /tmp/activerecord-deprecated_finders/test/associations_test.rb:49:in `block (2 levels) in <top (required)>'


  3) Error:
associations#test_0006_supports proc where values:
ArgumentError: wrong number of arguments (given 0, expected 1)
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/spawn_methods.rb:41:in `instance_exec'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/spawn_methods.rb:41:in `merge!'
    /tmp/activerecord-deprecated_finders/lib/active_record/deprecated_finders/association_builder.rb:22:in `block in to_proc'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:191:in `instance_exec'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:191:in `eval_scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:155:in `block (2 levels) in add_constraints'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:154:in `each'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:154:in `block in add_constraints'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `each'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `each_with_index'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `add_constraints'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:39:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:5:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association.rb:97:in `association_scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association.rb:86:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_association.rb:423:in `scope'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_proxy.rb:37:in `initialize'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/delegation.rb:106:in `new'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/delegation.rb:106:in `create'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_association.rb:39:in `reader'
    /home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/builder/association.rb:115:in `comments'
    /tmp/activerecord-deprecated_finders/test/associations_test.rb:67:in `block (2 levels) in <top (required)>'

68 runs, 123 assertions, 0 failures, 3 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -I"test" -w -I"/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/rake-10.5.0/lib" "/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/rake-10.5.0/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" ]

Tasks: TOP => default => test
(See full trace by running task with --trace)

Also, I needed to do the following in order to run the tests at all, because with rails 5.0.0.beta3 the tests crashed during load:

diff --git a/activerecord-deprecated_finders.gemspec b/activerecord-deprecated_finders.gemspec
index 7bf2ebd..fb64ab4 100644
--- a/activerecord-deprecated_finders.gemspec
+++ b/activerecord-deprecated_finders.gemspec
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
   gem.require_paths = ["lib"]

   gem.add_development_dependency 'minitest',     '>= 3'
-  gem.add_development_dependency 'activerecord', '>= 4.0.0.beta', '< 5'
+  gem.add_development_dependency 'activerecord', '~> 4.2'
   gem.add_development_dependency 'sqlite3',      '~> 1.3'
 end

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.