Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better mime type handling #3

Merged
merged 1 commit into from Sep 16, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions js/jquery.js_message.js
Expand Up @@ -6,6 +6,17 @@
}
};

/* set up a converter and accepts dataType to allow rails to
"respond_to" jsm based on the accepts header */
$.ajaxSetup({
accepts: {
jsm: "text/jsm, application/jsm"
},
converters: {
"text jsm": jQuery.parseJSON
}
});

// Appends the ".jsm" to a URL. It will not append the extension
// if the URL already has it.
$.appendJSMExt = function(url){
Expand Down
3 changes: 2 additions & 1 deletion lib/js_message/railtie.rb
Expand Up @@ -8,7 +8,8 @@ class Railtie < Rails::Railtie
include JsMessage::ControllerMethods
end

Mime::Type.register_alias "application/json", :jsm
Mime::Type.register "application/jsm", :jsm

end

rake_tasks do
Expand Down