Hi. I am new to RoR. I am beginning my first app. It’s a simple
application for roofing contractors.
I want to start slow. I can “migrate” as I go, correct?? (smile)
So Far I have Three Models:
CUSTOMERS , JOBS, ESTIMATES
there will be more someday.
So far, the model should adhere to these simple rules:
-
You can enter a customer without it being a JOB or ESTIMATE.
-
You can CONVERT a customer to a JOB.
-
You can CONVERT an ESTIMATE to a JOB.
-
A JOB MUST have a customer.
-
An ESTIMATE MUST have a customer.
-
CUSTOMER can have MANY jobs.
-
CUSTOMER can have MANY ESTIMATES.
-
Once converted from ESTIMATE to JOB , removed from ESTIMATE.
Holy cow… did I bite off more than I can chew here??? At first
this seemed rather simple until I just typed it all out!
Ok, I don’t have ANY code so far. Watched TONS of screencasts,
purchased a few, books, etc. I think (thought) I was ready. Here
goes… Please be gentle…
CUSTOMER MODEL:
class Customer< ActiveRecord::Base
has_many: estimates
has_many: jobs
end
ESTIMATE MODEL:
class Estimate< ActiveRecord::Base
belongs_to : customer
end
JOB MODEL:
class Job< ActiveRecord::Base
belongs_to : customer
end
Is it that simple?? Does my above code adhere to all my rules ( or
SOME anyways? ).
Thanks! Again, first application.
Regards,
Giovanni