Skip to content

Commit

Permalink
カラム名を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
udaikue committed Sep 23, 2021
1 parent 561932f commit 0ab7297
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/controllers/courses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def course_params
params.require(:course).permit(
:title,
:description,
:is_opened,
:open,
category_ids: []
)
end
Expand Down
4 changes: 2 additions & 2 deletions app/views/courses/_course.html.slim
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.col-xxl-3.col-xl-4.col-lg-4.col-md-6.col-xs-12
.courses-item(id="course_#{course.id}" class="#{course.open_course ? 'is-opened' : 'is-closed'}")
.courses-item(id="course_#{course.id}" class="#{course.open ? 'is-opened' : 'is-closed'}")
.courses-item__inner.a-card
header.courses-item__header
h3.courses-item__title
= link_to [course, :practices], class: 'courses-item__title-link' do
- if admin_login? && !course.open_course
- if admin_login? && !course.open
.courses-item__title-icon.is-closed
| 非表示
span.courses-item__title-label
Expand Down
2 changes: 1 addition & 1 deletion app/views/courses/_form.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.col-md-6.col-xs-12
= f.label 'コースを表示する', class: 'a-form-label'
label.a-on-off-checkbox.is-md
= f.check_box :is_opened, class: 'is-open-checkbox'
= f.check_box :open, class: 'is-open-checkbox'
span#checkbox-open-course
.form-item
.row.js-markdown-parent
Expand Down
2 changes: 1 addition & 1 deletion app/views/courses/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ header.page-header
- if current_user&.admin?
= render @courses.order(:created_at)
- else
= render @courses.where(open_course: true).order(:created_at)
= render @courses.where(open: true).order(:created_at)
5 changes: 0 additions & 5 deletions db/migrate/20210805050956_add_open_course_to_courses.rb

This file was deleted.

This file was deleted.

5 changes: 5 additions & 0 deletions db/migrate/20210923053650_add_open_to_courses.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddOpenToCourses < ActiveRecord::Migration[6.1]
def change
add_column :courses, :open, :boolean, default: false, null: false
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2021_09_16_061442) do
ActiveRecord::Schema.define(version: 2021_09_23_053650) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -140,7 +140,7 @@
t.text "description", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "is_opened", default: false, null: false
t.boolean "open", default: false, null: false
end

create_table "courses_categories", force: :cascade do |t|
Expand Down

0 comments on commit 0ab7297

Please sign in to comment.