class TopicsController
Public Instance Methods
create()
click to toggle source
# File lib/generators/squeezer/templates/app/controllers/topics_controller.rb, line 17 def create @topic = Topic.new(params[:topic]) @topic=Comment.add_comment(@topic) Comment.add_post(@topic.comment.id,params[:post][:body]) flash[:notice]="Listo!" redirect_to @topic end
destroy()
click to toggle source
# File lib/generators/squeezer/templates/app/controllers/topics_controller.rb, line 40 def destroy @topic = Topic.find(params[:id]) @topic.destroy flash[:notice] = "Successfully destroyed topic." redirect_to topics_url end
edit()
click to toggle source
# File lib/generators/squeezer/templates/app/controllers/topics_controller.rb, line 26 def edit @topic = Topic.find(params[:id]) end
index()
click to toggle source
# File lib/generators/squeezer/templates/app/controllers/topics_controller.rb, line 2 def index @topics = Topic.all end
new()
click to toggle source
# File lib/generators/squeezer/templates/app/controllers/topics_controller.rb, line 11 def new @topic = Topic.new @topic.forum_id=params[:id] @post = Post.new end
show()
click to toggle source
# File lib/generators/squeezer/templates/app/controllers/topics_controller.rb, line 6 def show @topic = Topic.find(params[:id]) Comment.posts(@topic) end
update()
click to toggle source
# File lib/generators/squeezer/templates/app/controllers/topics_controller.rb, line 30 def update @topic = Topic.find(params[:id]) if @topic.update_attributes(params[:topic]) flash[:notice] = "Successfully updated topic." redirect_to @topic else render :action => 'edit' end end