Skip to content
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

Update ActiveRecord::ModelSchema#table_name= 's doc #18622

Merged
merged 1 commit into from
Jan 27, 2015
Merged

Update ActiveRecord::ModelSchema#table_name= 's doc #18622

merged 1 commit into from
Jan 27, 2015

Conversation

take
Copy link
Contributor

@take take commented Jan 21, 2015

Docs for overriding ActiveRecord::Base#table_name exists in AR::ModelSchema#table_name's doc. ref:

# Alternatively, you can override the table_name method to define your
# own computation. (Possibly using <tt>super</tt> to manipulate the default
# table name.) Example:
#
# class Post < ActiveRecord::Base
# def self.table_name
# "special_" + super
# end
# end
# Post.table_name # => "special_posts"

@rafaelfranca
Copy link
Member

In fact I'd remove both documentation about overriding this method. It may cause unexpected results since table_name= does more than just set the @table_name.

@take
Copy link
Contributor Author

take commented Jan 22, 2015

@rafaelfranca I see. I guess that would mean deleting

# Sets the table name explicitly. Example:
#
# class Project < ActiveRecord::Base
# self.table_name = "project"
# end
#
# You can also just define your own <tt>self.table_name</tt> method; see
# the documentation for ActiveRecord::Base#table_name.
and
# You can also set your own table name explicitly:
#
# class Mouse < ActiveRecord::Base
# self.table_name = "mice"
# end
#
?

Overriding these methods may cause unexpected results since
"table_name=" does more then just setting the "@table_name".

ref: #18622 (comment)
@take
Copy link
Contributor Author

take commented Jan 27, 2015

@rafaelfranca aha ok updated :)

seuros added a commit that referenced this pull request Jan 27, 2015
Update ActiveRecord::ModelSchema#table_name= 's doc
@seuros seuros merged commit 75a1ab5 into rails:master Jan 27, 2015
@seuros
Copy link
Member

seuros commented Jan 27, 2015

Thanks you

@take take deleted the patch-1 branch January 27, 2015 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants