Topic: Simple question about models
I have a real simple question to ask you guys.
I have 2 models: Clients & Projects.
Here is how I defined both models in RoR:
class Client < ActiveRecord::Base
class Project < ActiveRecord::Base
validates_presence_of :client_id, :name;
Now i want to be able to check how many projects I have for every client.
So I have created a function inside the Project model that just just that:
count(:all, :conditions => ['client_id = ?', client.id])
But it doesn't work
Can anybody help me?
Another question. How can I display the list of projects for a specific client in his "Show" section?