[Solved] How to find out the number of records in a table? [closed]

[ad_1]

It would be something like this on your model:

def self.pending_count
 where(status: 0).count
end


def self.in_progress_count
 where(status: 1).count
end

def self.finished_count
 where(status: 2).count
end

Then you can just call Model.pending_count (or the other methods) wherever you need it.

[ad_2]

solved How to find out the number of records in a table? [closed]