Scaffold park model
This commit is contained in:
2
app/models/park.rb
Normal file
2
app/models/park.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
class Park < ApplicationRecord
|
||||||
|
end
|
||||||
13
db/migrate/20251008044109_create_parks.rb
Normal file
13
db/migrate/20251008044109_create_parks.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class CreateParks < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :parks do |t|
|
||||||
|
t.string :code, null: false
|
||||||
|
t.string :name, null: false
|
||||||
|
t.datetime :established_date, null: false
|
||||||
|
t.text :states, null: false
|
||||||
|
t.json :properties, null: false, default: {}
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
11
db/schema.rb
generated
11
db/schema.rb
generated
@@ -10,5 +10,14 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 0) do
|
ActiveRecord::Schema[8.0].define(version: 2025_10_08_044109) do
|
||||||
|
create_table "parks", force: :cascade do |t|
|
||||||
|
t.string "code", null: false
|
||||||
|
t.string "name", null: false
|
||||||
|
t.datetime "established_date", null: false
|
||||||
|
t.text "states", null: false
|
||||||
|
t.json "properties", default: {}, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
15
test/fixtures/parks.yml
vendored
Normal file
15
test/fixtures/parks.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
code: MyString
|
||||||
|
name: MyString
|
||||||
|
established_date: 2025-10-07 21:41:09
|
||||||
|
states: MyText
|
||||||
|
properties:
|
||||||
|
|
||||||
|
two:
|
||||||
|
code: MyString
|
||||||
|
name: MyString
|
||||||
|
established_date: 2025-10-07 21:41:09
|
||||||
|
states: MyText
|
||||||
|
properties:
|
||||||
7
test/models/park_test.rb
Normal file
7
test/models/park_test.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class ParkTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user