-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct link for model generator field types #25748
Correct link for model generator field types #25748
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@@ -209,7 +209,7 @@ Description: | |||
Create rails files for model generator. | |||
``` | |||
|
|||
NOTE: For a list of available field types, refer to the [API documentation](http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#method-i-column) for the column method for the `TableDefinition` class. | |||
NOTE: For a list of available field types, refer to the [API documentation](http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_column) for the add_column method for the `SchemaStatements` module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the first link lists out usage of :index
as well, which is mentioned in this command. Moreover, I think TableDefinition
acts a better entry-point documentation for this behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation! If that's the intent, I think there might be a way to change the wording on the Command Line guides page to explain the greater intent of what's being linked to, but I can't think of what that would be right now, so it's probably good as-is.
It does still feel like two clicks to get to the list of field types is a bit unfortunate, since that's such a common thing to look up—it's confused me more than once as I've tried to find it. It seems like something that could actually be added into the guides themselves, as in the Laravel framework. If there's any interest in thinking through ways to make it easier for users to get access to this data, I'm happy to be in the convo and do the doc updates for it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably expand here what the index is for, and just link to SchemaStatements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will think through that and send you a commit when I have a first shot at it.
@vipulnsward Take a look at my first shot when you get the chance! I'm sure wordsmithing could be improved. |
@CodingItWrong can you squash the commits? |
The most complete list of field types appears in the `SchemaStatements` docs rather than the `TableDefinition` docs. The change to link to `SchemaStatements` means that the explanation for the `index` parameter is no longer available on the linked-to page. A brief explanation of the `index` parameter is added directly in the guide to make up for this.
@vipulnsward ok, commits squashed |
Thanks |
It's common to want to look up the field types that can be used in model generators. The Command Line guide provides a link to "a list of available field types", but the page it links to (the API docs for
TableDefinition#column
) doesn't actually show that list. Instead, it provides another link to the docs forSchemaStatements#add_column
"for available options", which includes the list of field types (":primary_key, :string, :text,...").This PR changes the link on the command line guide to go directly to
SchemaStatements#add_column
, since showing that list of field types seems to be the intent of linking and becauseTableDefinition#column
doesn't appear to add anything to that goal.