Class: ErpForms::ErpApp::Desktop::DynamicForms::CommentsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/erp_forms/erp_app/desktop/dynamic_forms/comments_controller.rb

Instance Method Summary collapse

Instance Method Details

#addObject


4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/erp_forms/erp_app/desktop/dynamic_forms/comments_controller.rb', line 4

def add
  @myDynamicObject = DynamicFormModel.get_constant(params[:model_name]).find(params[:id])
  @comment = @myDynamicObject.add_comment({
      :commentor_name => current_user.party.description, 
      :email => current_user.email, 
      :comment => params[:comment]
    })

  render :json => (@comment.valid? ? {:success => true} : {:success => false})
end