Within coffescript code I have
app/assets/javascript/drill.js.coffee
...
$('document').ready ->
if $('#x_eval_assum').length == 1
$('#x_eval_assum')
.submit (event) ->
event.preventDefault()
data = $("#x_eval_assum").serialize()
drill_id = $('.form.assumption').attr('data-drillid')
$.post "/drills/#{drill_id}/discovery_target_saved.json", data, (res)->
console.log(' here ')
.change (event) ->
event.preventDefault()
...
app/controller/drills_controller.rb
...
def discovery_target_saved
load_evaluation_assumption_selections
load_user_positions
render :json, {data: @drill.id}
end
In Developer Tools Console I see this error POST .. host:3000/drills/13/discovery_target_saved.json 500 (Internal Server Error)
Have tried a number of variations - what am I doing wrong ?
More stuff
Both "load_evaluation_assumption_selections" and "load_user_positions" are Drill Controller actions that are working correctly and are used by other Drill actions.
I currently have another error showing on the internal log- specifically
Completed 500 Internal Server Error in 46ms
ActionView::MissingTemplate - Missing template drills/json, application/json with {:locale=>[:en], :formats=>[:json], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in:
* "/Users/davidlee/drill_investor/app/views"
* "/Users/davidlee/.rvm/gems/ruby-2.1.1/gems/devise-3.4.0/app/views"
:
actionview (4.1.6) lib/action_view/path_set.rb:46:in find'
actionview (4.1.6) lib/action_view/lookup_context.rb:124:infind
load_evaluation_assumption_selectionsandload_user_positions. I guess we can't answer the question, because there is not enough information from your side. - Robin@drillgetting set in the controller? If not then you'll get ano method errorwhen you call.idon@drill- John$.postline with this version:$.post "/drills/#{drill_id}/discovery_target_saved", data, (res)-> console.log('here'), "json"- John