1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties
Petrik d163fcd620 Generators should raise an error if a field has an invalid type
Generators can create invalid migrations when passing an invalid
field type. For example, when mixing up the name and type:

    bin/rails g model post string:title

This will generate a field for post with a column named `string`
of the type `title`, instead of a column named `title` of the type
`string`. Running the migration will result in an error as the type
`title` is not known to the database.

Instead of generating invalid files, the generator should raise an error
if the type is invalid. We validate the type by checking if it's a
default migration types like: string, integer, datetime, but also
references, and rich_text.

If the type isn't a default type, we can ask the
database connection if the type is valid. This uses the `valid_type?`
method defined on each database adapter, which returns true if the
adapter supports the column type. This method is also used by the
SchemaDumper.

Some gems like 'postgis' add custom types. The 'postgis' gem adds these
types by overriding the `native_database_types` method.
That method is used by `valid_type?` method on the database adapter,
making this change compatible with 'postgis'.
2021-05-29 15:17:36 +02:00
..
bin
exe
lib Generators should raise an error if a field has an invalid type 2021-05-29 15:17:36 +02:00
test Generators should raise an error if a field has an invalid type 2021-05-29 15:17:36 +02:00
.gitignore Install JavaScript packages before run test 2019-02-11 09:58:08 +09:00
CHANGELOG.md Generators should raise an error if a field has an invalid type 2021-05-29 15:17:36 +02:00
MIT-LICENSE Bump license years to 2021 [ci skip] 2021-01-01 12:21:20 +09:00
railties.gemspec Make sure the version of rake used in Rails apps work 2021-03-15 20:48:38 +00:00
Rakefile Fallback to spawn instead of fork in jruby (#36111) 2019-04-26 17:22:28 -05:00
RDOC_MAIN.rdoc [ci skip] Fix broken links on RDOC_MAIN.rdoc 2021-04-30 09:22:28 +02:00
README.rdoc Fix grammar mistakes [ci skip] 2021-04-10 22:15:52 -05:00

= Railties -- Gluing the Engine to the Rails

Railties is responsible for gluing all frameworks together. Overall, it:

* handles the bootstrapping process for a Rails application;

* manages the +rails+ command line interface;

* and provides the Rails generators core.

== Download

The latest version of Railties can be installed with RubyGems:

* gem install railties

Source code can be downloaded as part of the Rails project on GitHub

* https://github.com/rails/rails/tree/main/railties

== License

Railties is released under the MIT license:

* https://opensource.org/licenses/MIT

== Support

API documentation is at

* https://api.rubyonrails.org

Bug reports can be filed for the Ruby on Rails project here:

* https://github.com/rails/rails/issues

Feature requests should be discussed on the rails-core mailing list here:

* https://discuss.rubyonrails.org/c/rubyonrails-core