Skip to content

Instantly share code, notes, and snippets.

@Znow
Created May 3, 2012 07:30
Show Gist options
  • Save Znow/2584017 to your computer and use it in GitHub Desktop.
Save Znow/2584017 to your computer and use it in GitHub Desktop.
def update
@task = Task.find_by_id(params[:id])
respond_to do |format|
if @task.update_attributes(params[:task])
flash[:success] = "<strong>Success!</strong> #{@task.subject} was successfully edited.".html_safe
end
format.js { render :template => "admin/tasks/update.js.erb",
:locals => { :task => @task, :redirect_path => } #admin_tasks_path
} # update.js.erb
end
end
jQuery(function($) {
<%= render :partial => "admin/shared/modal_ujs",
:locals => {
:resource => task,
:form_el => "edit-task-form#{task.id}",
:redirect_path => redirect_path
}
%>
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment