$ -> role_selector = $el: $("#role_id") select_new_role: -> role_selector.$el.on "change", (event) -> $.post "home/role_change", { data: role_selector.$el.val() }, (data) -> window.location.href = data.redirect init: -> role_selector.select_new_role() role_selector.init()