socialforge/app/controllers/discuss_demos_controller.rb

36 lines
798 B
Ruby
Raw Normal View History

2015-03-17 09:40:31 +08:00
class DiscussDemosController < ApplicationController
def index
2015-03-18 08:53:36 +08:00
2015-03-17 09:40:31 +08:00
@discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10)
end
def new
@discuss_demo = DiscussDemo.create
@discuss_demo.save!
@discuss_demo
end
def create
end
def update
@discuss_demo = DiscussDemo.find(params[:id])
@discuss_demo.update_attributes(:title => params[:discuss_demo][:title],:body => params[:discuss_demo][:body])
redirect_to :controller=> 'discuss_demos',:action => 'show',:id => params[:id]
end
def delete
end
def destroy
2015-03-18 08:53:36 +08:00
DiscussDemo.destroy(params[:id])
2015-03-17 09:40:31 +08:00
redirect_to :controller=> 'discuss_demos',:action => 'index'
end
def show
@discuss_demo = DiscussDemo.find(params[:id])
end
end