fixed lessons
This commit is contained in:
parent
4d8a5138f2
commit
43dcc338ad
|
|
@ -29,6 +29,7 @@ module Admin
|
|||
@lesson = Lesson.new(admin_lesson_params)
|
||||
@week = @lesson.week
|
||||
@lesson.course = @week.course
|
||||
@course = @week.course
|
||||
params[:week_id] = @week.id
|
||||
respond_to do |format|
|
||||
if @lesson.save
|
||||
|
|
@ -89,6 +90,7 @@ module Admin
|
|||
def set_object
|
||||
@lesson = Lesson.find(params[:id])
|
||||
@week = @lesson.week
|
||||
@course = @week.course
|
||||
params[:week_id] = @week.id
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ module Admin
|
|||
|
||||
# GET /admin/weeks/1
|
||||
# GET /admin/weeks/1.json
|
||||
def show; end
|
||||
def show
|
||||
@lessons = @week.lessons.page(params[:page])
|
||||
end
|
||||
|
||||
# GET /admin/weeks/new
|
||||
def new
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class Week < ApplicationRecord
|
|||
|
||||
# == Relationships ========================================================
|
||||
belongs_to :course
|
||||
has_many :lessons
|
||||
|
||||
# == Validations ==========================================================
|
||||
validates :name, presence: true
|
||||
|
|
|
|||
Loading…
Reference in New Issue