Commit Graph

5 Commits

Author SHA1 Message Date
Javi Martín
49e55b4dc4 Apply Rails/DynamicFindBy rubocop rule
We were already using `find_by` most of the time.

Since there are false positives related to our `find_by_slug_or_id!` and
`find_by_manger_login` methods, which cannot be replaced with `find_by`,
I'm adding it indicating the "refactor" severity.
2019-10-23 20:05:40 +02:00
Julian Herrero
22076dd95c Add method find_by_slug_or_id! to Sluggable module
Make it easier to find by slug or id for sluggable models. It will
raise a 404 HTML Not found error if the resource is not found.
2019-06-03 16:54:39 +02:00
Julian Herrero
3bf2fa1b17 Add method find_by_slug_or_id to Sluggable module
Make it easier to find by slug or id for sluggable models. Will return
nil if resource is not found.
2019-01-25 09:08:28 +01:00
Bertocq
e0871e5dc6 Only update slug if empty or model condition is met 2018-02-04 23:04:48 +01:00
Bertocq
4535fc9345 Create Sluggable concern, generates slug using name attribute before validation
Why:

* We need a way to generate a slug for a object given his name attribute value

How:

* A concern that generates the slug before validation
2017-07-04 18:40:54 +02:00