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

Feature Request: Annotate via attributes api #3

Open
amerov opened this issue Mar 28, 2021 · 1 comment
Open

Feature Request: Annotate via attributes api #3

amerov opened this issue Mar 28, 2021 · 1 comment

Comments

@amerov
Copy link

amerov commented Mar 28, 2021

Add option for annotation via attributes api for rails >=5

class Movie < ActiveRecord::Base
  #added by the_schemas_is
  attribute :id, :integer 
  attribute :name, :string
  attribute :created_at, :datetime
  attribute :updated_at, :datetime
end
@zverok
Copy link
Owner

zverok commented May 2, 2021

This is an interesting idea, haven't thought about it.
What bothers me, though, is as attribute a generic tool, so our cop can't guess: if some attribute doesn't have a correspondence in the schema.rb, is it discrepancy and should be removed, or it is just unrelated usage of attribute API?

That is a downside I can think of. And another one is: somebody unfamiliar with the_schema_is concept when seeing the_schema_is block will guess where to look to understand it; when seeing the attribute :id (which nobody typically does just to "copy" a column definition to a class), they wouldn't know what to think.

What are the upsides of this idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants