Skip to content

Commit

Permalink
Update auto-generated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 committed Dec 29, 2018
1 parent 62f879b commit a7eb2a6
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions manual/cops_rails.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,43 @@ Include | `app/models/**/*.rb` | Array

* [https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option](https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option)

## Rails/HelperInstanceVariable

Enabled by default | Supports autocorrection
--- | ---
Enabled | No

This cop checks for use of the helper methods which reference
instance variables.

Relying on the existing of a particular instance variable
makes it difficult to re-use helper methods in different
contexts.

If it seems awkward to explicitly pass in each dependent
variable, consider moving the behaviour elsewhere, for
example to a model, decorator or presenter.

### Examples

```ruby
# bad
def welcome_message
"Hello " + @user.name
end

# good
def welcome_message(user)
"Hello " + user.name
end
```

### Configurable attributes

Name | Default value | Configurable values
--- | --- | ---
Include | `app/helpers/**/*.rb` | Array

## Rails/HttpPositionalArguments

Enabled by default | Supports autocorrection
Expand Down

0 comments on commit a7eb2a6

Please sign in to comment.