Skip to content
rubytester edited this page Oct 2, 2013 · 3 revisions

The model_type is a way of giving a hint to controllers about models that they can consume

For example, let's say we have a Donation controller and it's configured to take a model that's a Donor. We want to be able to pass in a Single Donation Donor and a Recurring Donation Donor to that same controller and have the controller automatically know it has a relationship with that model.

Donation < Watirmark::WebPage::Controller
  @model = Donor
  @view = DonationView
end

class SingleDonorModel < Watirmark::Model::Factory 
  keywords SingleDonorModelView.keywords
  model_type Donor
end

class RecurringDonorModel < Watirmark::Model::Factory 
  keywords RecurringDonorModelView.keywords
  model_type Donor
end
Clone this wiki locally