Commit Graph

5288 Commits

Author SHA1 Message Date
Rafael França
541b78a71f
Merge pull request #33685 from krusty3002/master
Added explanation about new_framework_defaults.rb file [ci skip]
2018-08-22 13:05:51 -05:00
Guo Xiang Tan
20bb397e00 Add database configuration to disable advisory locks.
https://github.com/rails/rails/issues/31190
2018-08-22 22:06:08 +08:00
Claas Zurawski
d587cf2325 Fixed file name [ci skip] 2018-08-22 10:15:49 +02:00
Claas Zurawski
4858310e36 Added explanation about new_framework_defaults.rb file [ci skip] 2018-08-22 10:04:28 +02:00
George Claghorn
14ecf58b54 Add missing newline [ci skip] 2018-08-21 22:35:09 -04:00
Mr. Outis
63f63fe67b [ci skip] Add ImageMagick to ActiveStorage dependencies
In order to run ActiveStorage's tests successfully, you need
imagemagick.
2018-08-21 20:48:04 -05:00
Fabian Schwahn
ec6089995d Improve documentation of Procs as :if / :unless options for callbacks 2018-08-20 11:44:31 +02:00
Richard Schneeman
2247077b0b
Merge pull request #33621 from sikachu/sikachu-guide-rubocop
Update guide to mention code linters available
2018-08-19 14:44:17 -07:00
bogdanvlviv
b91dc57928
DRY in Active Record Query Interface [ci skip]
The sentence "This is exactly the same as defining a class method ..."
is not true, so #33653 fixed it, but added changes repeat what is explained
a few lines below. We can remove this part since a user is able to get info
about the difference between scopes and class methods below.

Context https://github.com/rails/rails/pull/33653#discussion_r211105969.

Reverts #33653, 97feb4996b1c88f770101dfce6d4d3a6baf6bb33.
2018-08-19 19:29:41 +03:00
Ryuta Kamizono
97feb4996b Fix syntax error in the doc [ci skip] 2018-08-19 23:35:04 +09:00
Richard Schneeman
878800559d
Merge pull request #33653 from LemonAndroid/patch-1
Explained difference between scope & class method
2018-08-19 06:36:45 -07:00
yuuji.yaginuma
85a63e6888 Update google-cloud-storage gem version [ci skip]
Now requires version 1.11 or newer. Ref: bf5f41d948b6f3f27db7fdc2b70897aec991065f
2018-08-19 15:24:00 +09:00
LemonAndroid
e2589989d0
Explained difference between scope & class method 2018-08-19 05:07:03 +02:00
Ryuta Kamizono
6563a73e89 Merge pull request #33537 from ZASMan/update_action_mailer_docs_custom_view_paths
Add note for custom mailer view paths in action mailer guide. [ci skip]
2018-08-17 12:43:09 +09:00
Zane
16acf4f9c7 Add note for custom mailer view paths in action mailer guide. [ci skip]
Adds stuff

Fixes a typo

Integrates changes

Adds link to append_view_path in actionmailer guide.
2018-08-16 21:37:08 -04:00
Anton Rieder
852b688669
Harmonize shell commands in dev guide [ci skip] 2018-08-16 12:31:49 +02:00
Prem Sichanugrist
cdabcc2bd5
Update guide to mention code linters available
Contributors can run RuboCop locally to catch code style error in Ruby
code and npm lint task for `rails-ujs` CoffeeScript and JavaScript code.

[skip ci]
2018-08-15 15:45:08 +09:00
bogdanvlviv
77b0126054
Add Array#extract!
The method removes and returns the elements for which the block returns a true value.
If no block is given, an Enumerator is returned instead.

```
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
numbers # => [0, 2, 4, 6, 8]
```
2018-08-14 19:53:12 +03:00
Darren
2efae0796a Fix header setting doc in testing guide [ci skip] 2018-08-13 14:06:49 +08:00
bogdanvlviv
e1817f80b4
Clarify "Old Migrations" in "Active Record Migrations" guide [ci skip]
- Name rails app' files relatively to its root
  - `structure.sql` =>  `db/structure.sql`
  - `schema.rb` =>  `db/schema.rb`
- Clarify rails commands
  - `db:migrate` => `rails db:migrate`
  - `db:migrate:status` => `rails db:migrate:status`
- Add `/` to the end of `db/migrate` in order to express that it is
  directory and to keep consistency with `db/migrate/` above.

Follow up #33474
2018-08-12 22:25:29 +03:00
bogdanvlviv
e3ae53f92c
Clarify note that SQLite3 adapter doesn't support add_foreign_key [ci skip]
Context https://github.com/rails/rails/pull/33563#discussion_r208891486.

Follow up #33563
2018-08-12 22:25:11 +03:00
Richard Schneeman
bddab1fc86
Merge pull request #33474 from olivierlacan/old-migrations
Document best practices with old migrations
2018-08-11 14:54:37 -05:00
Richard Schneeman
141f50ef9e
Merge pull request #33563 from lzap/foreign-key-note-doc
ActiveRecord Guide - sqlite3 foreign keys note
2018-08-11 14:49:59 -05:00
Robin Dupret
74ce503fa9 Add missing instructions for FreeBSD [ci skip]
The development dependencies installation guides have the installation
instructions for FreeBSD in other sections so let's be consistent
regarding the dependencies for Active Storage setup.

Also fix a few typos.
2018-08-09 20:12:11 +02:00
Lukas Zapletal
847e691526 ActiveRecord Guide - sqlite3 foreign keys note 2018-08-09 11:14:56 +02:00
Eileen M. Uchitelle
3000c14905
Merge pull request #33554 from saveriomiroddi/sav-correct_updated_at_guide_explanation
ActiveRecord Basics guide: correct explanation of the `updated_at` logic [ci skip]
2018-08-08 10:08:03 -04:00
Saverio Miroddi
6ae302c9da ActiveRecord Basics guide: correct explanation of the updated_at logic [ci skip]
It's misleanding/incorrect to state that `updated_at` is set on updates, since creation != update (and the column is actually set on creation, too).
2018-08-08 16:06:06 +02:00
Ana María Martínez Gómez
3cb491f327 Add lambdas in conditional validations
As `Lambdas` are a type of `Proc`, they can also be used in the
`if`/`unless` option of a validation to decide when the validation is
executed. Add this case to the guide for clarification.

Closes https://github.com/rails/rails/issues/33212
2018-08-07 17:35:13 +02:00
George Claghorn
a69394e9fd
Merge pull request #33507 from jackc/patch-1
Fix file upload location recommendation
2018-08-03 18:09:25 -04:00
George Claghorn
ceac9bfb24
Merge pull request #33452 from thetizzo/rails_32_to_40_doc_update
[Documentation] Mention default HTTP headers in Rails 3.2 to 4.0 upgrade guide
2018-08-03 18:05:00 -04:00
thetizzo
94f9c31a72 Update Rails 3.2 to 4.0 upgrade guide to include a mention and tip for handling the addition of configurable default HTTP headers. [ci skip] 2018-08-03 13:18:19 -06:00
Ryan Brooks
05bafa7401
[ci skip] Update adding member routes guide to fix inconsistency with the implementation. Closes #33518 2018-08-03 12:40:18 +01:00
Olivier Lacan
4a2d5efa94 Document best practices with old migrations
The copy here is of course up for discussion but it feels like we need
to address the issue of old migrations in the Migration guide because
other than mentioning the canonical nature of schema.rb/structure.sql
or the actual database compared to migration files, it seems like more
guidance would help.

Here's a sample of the kinds of question people seem to often ask about
old Rails migrations:

- https://stackoverflow.com/questions/20119391/delete-old-migrations-files-in-a-rails-app
- https://www.reddit.com/r/rails/comments/4ayosd/compacting_migrations_files_or_delete_them/
- https://stackoverflow.com/questions/4248682/is-it-a-good-idea-to-purge-old-rails-migration-files
- https://stackoverflow.com/questions/707013/is-it-a-good-idea-to-collapse-old-rails-migrations
- https://stackoverflow.com/questions/1981777/rails-remove-old-models-with-migrations
- https://stackoverflow.com/questions/3343534/rebase-rails-migrations-in-a-long-running-project

The common theme seems to be: "I've got old migrations, should I keep
them around on an old project?".

My personal stance is that as long as migrations run and don't take too long do
so, you should keep them around since it allows people working on the Rails
project with you to seamlessly upgrade their local development database
without having to do a `db:drop db:schema:load` and lose all their seed data.

While writing down this suggested new section it felt like I was describing a
very cumbersome process that could be address with a rake task like:

```bash
rails db:migrate:remove VERSION=20121201123456
```

It rollback to the version just before `20121201123456`, delete the migration
file, and run `db:migrate` to get back to the latest migration.

This of course doesn't address a situation when someone would want to delete or
merge all migrations prior to a certain date, which is addressed by
[squasher](https://github.com/jalkoby/squasher).

I'm not sure this is something we want to encourage people to do. Although I
feel like with more and more production Rails apps over 5-years old, it's
definitely a concern we should address.
2018-08-03 12:59:04 +02:00
Jack Christensen
dd435da5b3
Fix file upload location recommendation
Going one level downwards from Rails' /public directory would still be inside the public directory and therefore servable by the web server. Files should stored upwards of the public directory.
2018-08-01 12:26:47 -05:00
Xavier Noria
fb12c03d68
Revert "Remove label 'work in progress' for AM and AV guides" 2018-07-31 21:43:51 +02:00
Richard Schneeman
f37982e41a
Merge pull request #31883 from bogdanvlviv/remove-label-in-porgress-for-M-V-guides
Remove label 'work in progress' for AM and AV guides
2018-07-31 15:33:34 -04:00
Aditya Kapoor
b1b585fe08 [ci skip] Fix the outdated description for find_each. 2018-07-31 13:26:02 +05:30
Eileen M. Uchitelle
45903be134
Merge pull request #33434 from utilum/remove_testing_guide_comment
Testing Guide: unnecessary comment
2018-07-27 10:18:47 -04:00
utilum
de2e797c49 AST Guide: install and migrate tasks in new app
This line refers only to an upgrade situation, but same is need to setup AST in a new application.

[ci skip]
2018-07-26 12:41:53 +02:00
Paul McMahon
978d486e4d Reference Active Storage instead of third-party libraries in guide
Paperclip has officially been deprecated, so we shouldn't mention it
anymore.

CarrierWave could still be referenced, as there are use cases where it
currently makes more sense, but for simplicity, I thought removing the
mention of third party libraries made sense. If we want to talk about
them, listing "alternatives" within the Active Storage guide could make
more sense.
2018-07-26 16:15:34 +09:00
utilum
2604d184ec Testing Guide: unnecessary comment
This has been around as far back as I can
[see](5137d03cc5/guides/source/testing.md).

No need to specify the obvious.

[ci skip]
2018-07-25 20:44:40 +02:00
Matthew Draper
ec387c6dd9
Merge pull request #33229 from albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails
Prefer rails command over bin/rails
2018-07-25 04:10:29 +09:30
Paul McMahon
7b9c19d94b Rails guides are now served over https
http links will be redirected to the https version, but still better to
just directly link to the https version.
2018-07-24 11:29:31 +09:00
K. Rodman Mannix
063003f3f7 [ci skip] fix typo in Associations guide 2018-07-22 10:37:26 -04:00
lanzhiheng
cf05cf7af5 Add situation for belongs to association. [ci skip] 2018-07-18 17:58:29 +08:00
Ryuta Kamizono
cd84d87164
Merge pull request #33364 from lanzhiheng/fix-document-in-model-validator
Modify the expression's issue for `errors.add` document.

[ci skip]
2018-07-16 15:21:25 +09:00
lanzhiheng
29ca7a1e07 Remove the invalid usage document about errors. [ci skip] 2018-07-16 09:53:43 +08:00
lanzhiheng
6c7c49fb6a Fix document issue in active record callback about after_touch hook. 2018-07-15 17:31:39 +08:00
Jędrek Domański
1e2650acbb Update documentation for #pluck method [ci skip] 2018-07-14 14:11:30 +02:00
bogdanvlviv
e62e68e25b
has_secure_password: use recovery_password instead of activation_token
Since we have `has_secure_token`, it is too confusing to use `_token`
suffix with `has_secure_password`.
Context https://github.com/rails/rails/pull/33307#discussion_r200807185
2018-07-08 14:12:27 +03:00