rails-style-guide icon indicating copy to clipboard operation
rails-style-guide copied to clipboard

A community-driven Ruby on Rails style guide

Results 43 rails-style-guide issues
Sort by recently updated
recently updated
newest added
trafficstars

My team is using RuboCop with [Rails cops enabled](https://github.com/bbatsov/rubocop#rails) as a first step in cleaning up a legacy codebase. We found some code like this: ``` ... after_initialize :set_variations def...

Addresses https://github.com/rubocop/rails-style-guide/issues/155

The passage on Single Attribute Validations currently reads as follows: [Single-attribute Validations](https://github.com/rubocop/rails-style-guide#single-attribute-validations) To make validations easy to read, don’t list multiple attributes per validation. # bad validates :email, :password, presence:...

Adding code loading best practices as used inside Shopify. cc @andyw8

Using an infinite range actually results in an inclusive query most of the time. Mirroring the documentation (using a "Client" model since my example app doesn't have "User") ```ruby Client.where("created_at...

Issue:https://github.com/rubocop/rubocop-rails/issues/565

This PR adds new `delete_by` and `destroy_by` rule. Rails 6.0 has been added `delete_by` and `destroy_by` as relation methods. Prefer the use of `delete_by` over `find_by(...)&.delete` and `where(...).delete_all`, and `destroy_by`...

If puzzles me what the type of the object is when I read something like: ```ruby user = find_user return if user.blank? ``` or ```ruby results = find_matches suggest(results) if...

Limiting public controller actions to the 7 standard actions prevents fat controllers and generally enforces better domain modeling, as demonstrated in this talk: https://www.youtube.com/watch?v=HctYHe-YjnE I would like to see a...