In Rails4, I have an method named get_values_from_models in Controller which take an parameter id:
app/controller/bugs_controller.rb
def get_values_from_models(id)
@online_bugs = Bugs.where(bug_id: id)
@devlopers = Devs.where(dev_role_id: 2)
end
I would like to call this method within the Jquery functionshow_bug_detail, which is in an partial view:
app/view/bugs/_get_values.html.erb
var id =5;
function show_bug_detail(id) {
//call method get_values_from_models, pass parameters 'id'
//get @online_bugs and @developers instances from returned.
}
Is that possible? How to do that? I have been searching the possible solutions for a while but without any fortune, it would be appreciate if someone can provide me any solution, thanks.