This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CreateCategory < ActiveRecord::Migration | |
| def change | |
| create_table :categories do |t| | |
| t.string :title, null: false | |
| t.text :description, null: false | |
| t.timestamps null: false | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fruits = Category.create(title: 'Fruits', description: "Ain't no veggie") | |
| veggies = Category.create(title: 'Vegetables', description: "Ain't no fruit") | |
| fruits.items.create(title: 'Apple', price: 100, expire_at: DateTime.now, count_1: rand(1..5), count_2: rand(1..5), count_3: rand(1..5), count_4: rand(1..5), validated: true) | |
| fruits.items.create(title: 'Pear', price: 150, expire_at: DateTime.now + 2.days, count_1: rand(1..5), count_2: rand(1..5), count_3: rand(1..5), count_4: rand(1..5), validated: false) | |
| fruits.items.create(title: 'Orange', price: 100, expire_at: DateTime.now + 2.days, count_1: rand(1..5), count_2: rand(1..5), count_3: rand(1..5), count_4: rand(1..5), validated: true) | |
| veggies.items.create(title: 'Cucumber', price: 100, expire_at: DateTime.now + 3.days, count_1: rand(1..5), count_2: rand(1..5), count_3: rand(1..5), count_4: rand(1..5), validated: true) | |
| veggies.items.create(title: 'Carrot', price: 150, expire_at: DateTime.now + 4.days, count_1: rand(1..5), count_2: rand(1..5), count_3: rand(1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ ] [ 1] [ ] [ ] | |
| [ ] [ 4] [ ] [ ] | |
| [ ] [ ] [ 3] [ ] | |
| [ ] [ ] [ 2] [ ] | |
| ------------------- | |
| [ ] [ 1] [ ] [ ] | |
| [ 5] [ 4] [ ] [ ] | |
| [ ] [ ] [ 3] [ ] | |
| [ ] [ ] [ 2] [ ] | |
| ------------------- |