OSDN Git Service

Render html page at /lectures/:id
authoreagletmt <eagletmt@gmail.com>
Fri, 19 Oct 2012 15:53:16 +0000 (00:53 +0900)
committereagletmt <eagletmt@gmail.com>
Fri, 19 Oct 2012 15:55:55 +0000 (00:55 +0900)
CutenServer/app/controllers/lectures_controller.rb
CutenServer/app/views/lectures/show.html.haml [new file with mode: 0644]

index ab2d964..8d3f59b 100644 (file)
@@ -50,7 +50,10 @@ class LecturesController < ApplicationController
   def show
     @lecture = Lecture.find(params[:id])
 
-    render json: @lecture
+    respond_to do |format|
+      format.html # show.html.haml
+      format.json { render :json => @lecture }
+    end
   end
 
   def tasks
diff --git a/CutenServer/app/views/lectures/show.html.haml b/CutenServer/app/views/lectures/show.html.haml
new file mode 100644 (file)
index 0000000..31bf915
--- /dev/null
@@ -0,0 +1,8 @@
+%p#notice= notice
+
+%p
+  %b Teacher
+  = @lecture.teacher.name
+%p
+  %b Name
+  = @lecture.name