callbax, yo
This commit is contained in:
parent
37bf5c5aee
commit
6dce04d2f5
2 changed files with 10 additions and 6 deletions
|
|
@ -41,6 +41,7 @@ class PhotosController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
raise "THAT IS NOT OKAY"
|
||||||
rescuing_photo_errors do |p|
|
rescuing_photo_errors do |p|
|
||||||
if remotipart_submitted?
|
if remotipart_submitted?
|
||||||
@photo = current_user.build_post(:photo, params[:photo])
|
@photo = current_user.build_post(:photo, params[:photo])
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,15 @@
|
||||||
= f.submit
|
= f.submit
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
|
// ugly hax to take us from remotipart land to normal backbone land
|
||||||
$(function(){
|
$(function(){
|
||||||
console.log($('#new_photo'))
|
$('#new_photo').bind('ajax:complete', function(evt, xhr) {
|
||||||
$('#new_photo').bind('ajax:success', function(event, data) {
|
resp = JSON.parse(xhr.responseText)
|
||||||
alert("happy day")
|
if(resp.success) {
|
||||||
console.log(data)
|
console.log("response was successful");
|
||||||
console.log(new Backbone.Model(data)); // Your newly created Backbone.js model
|
} else {
|
||||||
|
console.log(resp.error);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
//console.log(new Backbone.Model(data)); // Your newly created Backbone.js model
|
||||||
});
|
});
|
||||||
Loading…
Reference in a new issue