diff options
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/commands/console.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/commands/dbconsole.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/migration/USAGE | 13 |
3 files changed, 15 insertions, 2 deletions
diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index 78580b220c..4497ef61df 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -37,7 +37,7 @@ module Rails private def available_environments - Dir[Rails.root.join('config', 'environments', '*.rb')].map { |fname| File.basename(fname, '.*') } + Dir['config/environments/*.rb'].map { |fname| File.basename(fname, '.*') } end end diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb index 2d1e2d6a45..5914c9e4ae 100644 --- a/railties/lib/rails/commands/dbconsole.rb +++ b/railties/lib/rails/commands/dbconsole.rb @@ -147,7 +147,7 @@ module Rails end def available_environments - Dir[Rails.root.join('config', 'environments', '*.rb')].map { |fname| File.basename(fname, '.*') } + Dir['config/environments/*.rb'].map { |fname| File.basename(fname, '.*') } end def find_cmd_and_exec(commands, *args) diff --git a/railties/lib/rails/generators/rails/migration/USAGE b/railties/lib/rails/generators/rails/migration/USAGE index f340ed97f2..baf3d9894f 100644 --- a/railties/lib/rails/generators/rails/migration/USAGE +++ b/railties/lib/rails/generators/rails/migration/USAGE @@ -20,3 +20,16 @@ Example: add_column :posts, :title, :string add_column :posts, :body, :text add_column :posts, :published, :boolean + +Migration names containing JoinTable will generate join tables for use with +has_and_belongs_to_many associations. + +Example: + `rails g migration CreateMediaJoinTable artists musics:uniq` + + will create the migration + + create_join_table :artists, :musics do |t| + # t.index [:artist_id, :music_id] + t.index [:music_id, :artist_id], unique: true + end |