Skip to content

Commit

Permalink
id doesn't work very well sadge
Browse files Browse the repository at this point in the history
  • Loading branch information
one-m1nd committed Mar 4, 2024
1 parent 7c290c0 commit d3a0fee
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/models/plant.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
class Plant < ApplicationRecord
DEAD = 2
ALIVE = 1

belongs_to :family
belongs_to :genus
belongs_to :status
Expand All @@ -20,11 +17,11 @@ def trefle_data

class << self
def dead
Plant.where(status_id: DEAD)
Plant.where(status_id: Status.find_by(name: 'Dead'))
end

def alive
Plant.where(status_id: ALIVE)
Plant.where(status_id: Status.find_by(name: 'Alive'))
end
end
end

0 comments on commit d3a0fee

Please sign in to comment.