OSDN Git Service

歌詞表示の途中まで
[praisedb/praisedb.git] / app / controllers / songs_controller.rb
index 308341b..35c6b3a 100644 (file)
@@ -7,8 +7,12 @@ class SongsController < BaseController
     @song.font_size = Song.default_font_size
   end
 
+  def show
+    @song = Song.find params[:id]
+  end
+
   def create
-    render :action => :new unless params[:song]
+    return render :action => :new unless params[:song]
     @song = Song.new(params[:song])
     unless @song.valid?
       p @song.errors
@@ -27,6 +31,13 @@ class SongsController < BaseController
     redirect_to songs_path if @song.blank?
   end
 
+  def update
+    @song = Song.active.find_by_id(params[:id])
+    @song.attributes = params[:song]
+    @song.save
+    return redirect_to :action => :edit
+  end
+
   def list
     @songs = Song.active.all
   end