Until I think rails 5 (inclusive), one could add comments to the migration file, which then is dumped to the schema file. Will it be supported with rails 6 also ?
Thanks for any information.
in Rails 5 the support of adding comments in migrations was implemented https://github.com/rails/rails/pull/22911
the code is still present in the 6.0 stable branch
https://github.com/rails/rails/blob/6-0-stable/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb#L88
Related
Does anyone know when Rails 5.2 reaches end of life? Is there a central place where end of life dates for Rails are documented?
Rails don't do long term support of old versions. They only release security path.
You can get a better idea of how this work here:
https://guides.rubyonrails.org/maintenance_policy.html
It is important to emphasize that you have to keep updating the gem of rails to avoid incompatibilities in the future, see the case of the update of Github in rails 3 to version rails 6
https://github.blog/2018-09-28-upgrading-github-from-rails-3-2-to-5-2/
https://github.blog/2019-09-09-running-github-on-rails-6-0/
Rails 5.2.Z is included in the list of supported series until June 1st 2022.
You can find the central place where end of life dates for Rails are documented at https://endoflife.date/rails
or at https://guides.rubyonrails.org/maintenance_policy.html
I believe Rails 6 is still "Edge" (unreleased) and Rails 5 is the latest released version. (See this Q&A for definitions.) As such, I believe there is no EOL date for Rails 5.
I believe you can find, essentially, EOL information by looking at the latest release notes, as discussed in this Q&A.
Is there any alternative to partial_updates for Rails 4?
Because I have noticed that it was deprecated and I really need it so that my database ONLY updates the fields that were recently modified.
This is the screencast that i'm following : http://railscasts.com/episodes/109-tracking-attribute-changes?autoplay=true
The screencast you're watching was created in 2008 and is out of date. The default behavior for quite a while has been to only update modified fields - all 4.1 did was remove the (ignored) ability to configure it. Stop setting or using the partial_updates* methods, and everything will be fine.
I have a Rails project using rails 3.0.7.
I want to update it to 3.1.0.rc6.
However the directory structure of these are really different,
is there an automatic way to transfer the directory structure? Thank you very much.
I'm not aware of an automated way to update Rails apps to 3.1, but I found David Rice's blog entry about to be a pretty good overview of the steps involved. You can find the overview at: http://davidjrice.co.uk/2011/05/25/how-to-upgrade-a-rails-application-to-version-3-1-0.html
I created a github project to track the difference of the default generated project layout of rails
https://github.com/pmq20/rails-diff-track
When I manually enter tables into the .rb file in the migrate folder nothing shows up. I have followed a few different "how to's" but I can't get the tables to show up when I preview my work. I can however get one table to show up if I create it in the parameters when generating a scaffold, but that's one table. I have Rails version 2.3.4 and version 1.2.3 installed on my lame Windows Vista. I have tried using both versions multiple times. I am also trying to follow the Ruby on Rails for Dummies book, but it seems a little outdated. Any tips on getting tables to work? Its supposed to be really simple and take "just minutes" to complete this simple app. Maybe something didn't install right? Maybe a better book?
Just want to make sure you're using all the tools available to you:
To generate a migration file:
./script/generate MigrationFileName
Take a look at the Database Migrations Guide from the official Rails Guides for the correct syntax and options for creating a migration file.
Once you've created your migration, you need to run the following:
rake db:migrate
This will populate the database with the information specified in the migration file.
I want to run two rails websites (homepage and app) on the same database. However, migrations dont work because both websites try to use schema_migrations table at the same time.
Is it possible to override default schema_migrations table name? Any other ideas how to solve this problem?
The schema_migrations table name is kept in ActiveRecord::Migrator.schema_migrations_table_name, which you might me able to override (in environment.rb, initializers, etc.), but I haven't tried this.
On the other hand, if you use unique migration IDs in both application (default in 2.1 onwards, I think), migrations from two applications should work with a single schema_migrations table.
See this screencast for more information on how migrations work in Rails 2.1 and up.
I don't know when this was added but Rails 4 seems to support it now.
From the Rails documentation
config.active_record.schema_migrations_table_name lets you set a string to be used as the name of the schema migrations table.
If you are using a version of Rails where this is not supported then an alternative could be to use table_name_prefix. If you are using this approach, I'd make sure that your version of Rails prefixes schema migrations with table_name_prefix by looking at the source code.