Class: Qa::RepliesController

Inherits:
QaController
  • Object
show all
Defined in:
app/controllers/qa/replies_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/qa/replies_controller.rb', line 8

def create
  (render :nothing => true; return false) if params[:content].blank?

  @topic = QATopic.find(params[:topic_id])
  @reply = QAReply.create(default_data.merge(:topic_id => @topic.id))

  @replies = @topic.replies.map {|reply| reply.content = reply._content_markdown_cache; reply }
  @topic.update_attributes :replies_count => @replies.count
  @topic.content = @topic._content_markdown_cache # after update_attributes

  respond_to do |format|
    format.json { render :json => {:topic => @topic, :replies => @topic.replies}, :status => 200}
  end
end

#indexObject



5
6
# File 'app/controllers/qa/replies_controller.rb', line 5

def index
end