setup Bundler in engines `bin/rails` stub.

This is necessary when bundling gems locally using `BUNDLE_PATH`.
Without this patch `bin/rails` fails with:

```
/Users/senny/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rails/all (LoadError)
	from /Users/senny/.rbenv/versions/2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from bin/rails:7:in `<main>'
```
moving controller_name assignment before model name condition
Merge branch 'anilmaurya-master'
Ensure #second acts like #first AR finder
This commit bring the famous ordinal Array instance methods defined
in ActiveSupport into ActiveRecord as fully-fledged finders.

These finders ensure a default ascending order of the table's primary
key, and utilize the OFFSET SQL verb to locate the user's desired
record. If an offset is defined in the query, calling #second adds
to the offset to get the actual desired record.

Fixes #13743.
Merge pull request #13757 from terracatta/master

Ensure #second (and others) acts like #first AR finder
Remove unneded argument

This variable is internal and should not be exposed to end users
When applying changes or reseting changes create the right class

Before this patch after the changes are applied the changes can be only
accessed using string keys, but before symbols are also accepted.

After this change every state of the model will be consistent.
Forgot to push this change in the parent commit
Remove missed usage of @first variable

With the introduction of `#second` method and friends, we added an
offsets hash which replaced the @first variable, so removing it from the
reset method to avoid creating an unused variable now.

Introduced in bc625080308e4853ae3036f2ad74fe3826e463ef.
Fail early with "Primary key not included in the custom select clause" in find_in_batches

Before this patch find_in_batches raises this error only on second iteration. So you will know about the problem only when you get the batch size threshold.
Merge pull request #9969 from divineforest/fix-find-in-batches

Fail early with "Primary key not included in the custom select clause" i...
Active Record changelog wording and formatting. [ci skip]
Merge pull request #13696 from senny/engine_bin_rails_load_bundler

setup Bundler in engines `bin/rails` stub.
prepend table name for `Relation#select` columns.

This fixes a bug where `select(:id)` combined with `joins()` raised:

```
ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: id:
SELECT  id, authors.author_address_id
FROM "posts"
INNER JOIN "authors"
ON "authors"."id" = "posts"."author_id"
ORDER BY posts.id LIMIT 3
```

The `select_values` are still String and Symbols because other parts (mainly calculations.rb)
rely on that fact.

/cc @tenderlove
`has_one` and `belongs_to` accessors don't add ORDER BY to the queries anymore.

Since Rails 4.0, we add an ORDER BY in the `first` method to ensure consistent
results among different database engines. But for singular associations this
behavior is not needed since we will have one record to return. As this
ORDER BY option can lead some performance issues we are removing it for singular
associations accessors.

Fixes #12623.
Auto-generate stable fixture UUIDs on PostgreSQL.
Fixes: #11524
Fix handling of timestamp and datetime columns on PostgreSQL.

Timestamp columns are defined as `timestamp with time zone`,
datetime columns as `timestamp without time zone`. PostgreSQL
converts timestamp values from the local time zone to UTC for
storage and back; datetime values are treated as-is. This is in
line with MySQL.