zulhfreelancer
11/24/2015 - 4:14 AM

Respond to specific JS file in Rails controller

Respond to specific JS file in Rails controller

respond_to do |format|
    format.js {
        render  :template => "path/to/file.js.erb",
                :layout => false
    }
end

Example:

respond_to do |format|
    format.js {
        render  :template => "users/custom.js.erb",
                :layout => false
    }
end