'Creating a non-db bool attribute in model
I have a case where I'm defining a non-db attribute in my model:
def is_preview
@is_preview = full_url.nil? || 'preview'.in?(full_url)
end
Now since this is boolean, the Ruby convention is to set it as preview? We're using rubocop so I have to go with the convention, so I keep getting an error here. What is the Ruby way to create a boolean non-db attribute in a model?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
