firstdraft / appdev_template

A Rails template for generating homework projects
0 stars 1 forks source link

Add Alias for `ActiveRecord::AtributeMethods#[]` to `fetch` and `store` #43

Closed jelaniwoods closed 5 years ago

jelaniwoods commented 5 years ago

In response to this issue: #102

Alias the :[] attribute method for ActiveRecord with :fetch.

LoganDSPrice commented 5 years ago

Based on your other PR, LGTM!

raghubetina commented 5 years ago

@jelaniwoods I guess while we're at it, for completeness, shall we also add store as an alias for []=?

raghubetina commented 5 years ago

@jelaniwoods In this case perhaps alias_method is more suitable than alias?

https://github.com/rubocop-hq/ruby-style-guide#user-content-alias-method

jelaniwoods commented 5 years ago

@raghubetina I trusted rubocop to handle it and got

Style/Alias: Use alias instead of alias_method in a module body.

thoughtbot has this style Enabled: false, could that be why?

raghubetina commented 5 years ago

@jelaniwoods Ah interesting. Are we not using thoughtbot's .rubocop.yml in this project? Usually that's the one we put in all projects.

jelaniwoods commented 5 years ago

@raghubetina I am using thoughtbot's .rubocop.yml file. It looks like it doesn't have the style to use alias_method over alias enabled is what I mean.

https://github.com/thoughtbot/guides/blob/daf696183c3c94a7c00feae8443c7921752551b8/style/ruby/.rubocop.yml#L9

raghubetina commented 5 years ago

@jelaniwoods Ah, that makes more sense. So now do we trust thoughtbot or bbatsov/BigBinary? I guess let's trust thoughtbot until we have a good reason not to.

jelaniwoods commented 5 years ago

@raghubetina I've added .store to this pr too. How does this look?

raghubetina commented 5 years ago

@jelaniwoods LGTM :ship: