Skip to content

Instantly share code, notes, and snippets.

@joemocha
Created November 11, 2010 03:50
Show Gist options
  • Save joemocha/671967 to your computer and use it in GitHub Desktop.
Save joemocha/671967 to your computer and use it in GitHub Desktop.
class CommentsController < ApplicationController
before_filter :require_user
def index
@comments = Comment.all
end
def new
end
def create
params[:comment][:user_id] = session[:user]
@comment = Comment.new params[:comment]
# @comment = Comment.create(@comment)
if @comment.save
redirect_to comment_path(@comment)
else
render :action => :new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment