Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

2. Create Models, Migrations and Sample Data

(a) Create the models

First, generate some models for the sample data.

 

Code Block
rails g model supplyitem
rails g model employee

The smartclient gem uses mass-assignment, so you will need to enable that in the models.


Code Block
languageruby
titleapp/models/supplyitem.rb
class Supplyitem < ActiveRecord::Base
  attr_accessible :itemName, :sku, :description, :category, :units, :unitCost, :inStock, :nextShipment, :created_at, :updated_at
end
Code Block
languageruby
titleapp/models/employee.rb
class Employee < ActiveRecord::Base
  attr_accessible :name, :reportsTo, :job, :email, :employeeType, :employeeStatus, :salary, :orgUnit, :gender, :maritalStatus, :created_at, :updated_at
end

(b) Define and Run Migrations

...