File tree Expand file tree Collapse file tree 7 files changed +55
-0
lines changed Expand file tree Collapse file tree 7 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ class SuppliersController < AuthorizedController
2+ end
Original file line number Diff line number Diff line change 1+ class Supplier < ApplicationRecord
2+ end
Original file line number Diff line number Diff line change 1+ class SupplierResource < JSONAPI ::Resource
2+ attributes :company_name ,
3+ :contact_name ,
4+ :contact_title ,
5+ :address ,
6+ :city ,
7+ :region ,
8+ :postal_code ,
9+ :country ,
10+ :phone ,
11+ :fax ,
12+ :home_page
13+ end
Original file line number Diff line number Diff line change 55 jsonapi_resources :posts
66 jsonapi_resources :users
77 jsonapi_resources :roles
8+ jsonapi_resources :suppliers
89end
Original file line number Diff line number Diff line change 1+ class CreateSuppliers < ActiveRecord ::Migration [ 5.0 ]
2+ def change
3+ create_table ( :suppliers ) do |t |
4+ t . string :company_name
5+ t . string :contact_name
6+ t . string :contact_title
7+ t . string :address
8+ t . string :city
9+ t . string :region
10+ t . string :postal_code
11+ t . string :country
12+ t . string :phone
13+ t . string :fax
14+ t . text :home_page
15+ t . timestamps
16+ end
17+ end
18+ end
Original file line number Diff line number Diff line change 2020 tokens : nil
2121 ) . add_role n == 0 ? :admin : :user
2222end
23+
24+ 25 . times do |n |
25+ FactoryGirl . create ( :supplier )
26+ end
Original file line number Diff line number Diff line change 1+ FactoryGirl . define do
2+ factory :supplier do
3+ company_name { Faker ::Company . name }
4+ contact_name { Faker ::Name . name }
5+ contact_title { Faker ::Name . title }
6+ address { Faker ::Address . street_address }
7+ city { Faker ::Address . city }
8+ region { Faker ::Address . state }
9+ postal_code { Faker ::Address . postcode }
10+ country { Faker ::Address . country }
11+ phone { Faker ::PhoneNumber . cell_phone }
12+ fax { Faker ::PhoneNumber . cell_phone }
13+ home_page { "http://#{ Faker ::Company . name } .com" }
14+ end
15+ end
You can’t perform that action at this time.
0 commit comments