Merge pull request #12845 from amatsuda/should_ar_depend_on_rails

Refer to Rails.env from AR only when Rails is defined
Conflicts:
	activerecord/lib/active_record/migration.rb