I'm trying to implement an action which will be invoked when user submits a new comment via ajax. When the comment is saved single comment partial must return. But it seems that render doesn't work as expected from ApplicationController. It displays an error that the view is not found, but it is in place (100%). When I'm adding :partial
parameter it works, but doesn't pass any variables (and I need them!). Here's the controller code:
class ApplicationController < ActionController::Base
protect_from_forgery
def comment
comment = Comment.new({
story_id: params[:story_id],
content: params[:content]
})
if comment.save
render 'shared/comments/comment', comment: comment
else
render nothing: true, status: 400
end
end
end