Add brand to puzzles
This commit is contained in:
@@ -53,6 +53,6 @@ class PuzzlesController < ApplicationController
|
||||
end
|
||||
|
||||
def puzzle_params
|
||||
params.expect(puzzle: [ :name, :image ])
|
||||
params.expect(puzzle: [ :brand, :name, :image ])
|
||||
end
|
||||
end
|
||||
|
@@ -2,4 +2,5 @@ class Puzzle < ApplicationRecord
|
||||
belongs_to :contest
|
||||
has_one_attached :image
|
||||
validates :name, presence: true
|
||||
validates :brand, presence: true
|
||||
end
|
||||
|
@@ -27,7 +27,7 @@
|
||||
= image_tag puzzle.image if puzzle.image.attached?
|
||||
.card-body
|
||||
p.card-text
|
||||
| TODO puzzle.brand
|
||||
= puzzle.brand
|
||||
a.stretched-link href=edit_contest_puzzle_path(@contest, puzzle)
|
||||
.row
|
||||
.col
|
||||
|
@@ -4,6 +4,11 @@
|
||||
.form-floating
|
||||
= form.text_field :name, autocomplete: "off", class: "form-control"
|
||||
= form.label :name, class: "required"
|
||||
.row.mb-3
|
||||
.col
|
||||
.form-floating
|
||||
= form.text_field :brand, autocomplete: "off", class: "form-control"
|
||||
= form.label :brand, class: "required"
|
||||
.row.mb-3
|
||||
.col
|
||||
.form-text Select an image
|
||||
|
Reference in New Issue
Block a user