This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
finishedMaterializing: function(manager) { | |
var isDirty = get(manager, 'dirtyWhileMaterializing'); | |
if (isDirty) { | |
manager.transitionTo('loaded.updated'); | |
set(manager, 'dirtyWhileMaterializing', false); | |
} else { | |
manager.transitionTo('loaded.saved'); | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.User = DS.Model | |
settings: DS.belongsTo App.UserSettings | |
App.UserSettings = DS.Model | |
friends: DS.HasMany App.Friend | |
Adapter.map App.User | |
settings: {embedded: true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function proxyAjaxEvent(event, options, dit) { | |
var eventCallback = options[event]; | |
options[event] = function() { | |
// check if callback for event exists and if so pass on request | |
if (eventCallback) { eventCallback(arguments[ 0], arguments[ 2 ]); } | |
dit.processQueue(); // move onto next save request in the queue | |
} | |
} | |
Backbone.Model.prototype._save = Backbone.Model.prototype.save; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Location < ActiveRecord::Base¬ | |
▸ has_many :location_images, :dependent => :destroy¬ | |
▸ has_friendly_id :name, :use_slug => true¬ | |
▸ attr_accessible :cached_slug, :name, :description, :location_images_attributes¬ | |
¬ | |
▸ accepts_nested_attributes_for :location_images, :reject_if => lambda { |t| t['location_image'].nil? }¬ | |
¬ | |
end¬ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"utf8"=>"✓", | |
"authenticity_token"=>"uHqp3TSCzTpfjnMX+vJ/6vIIcaJaYP7JT0Qor5wYAxs=", | |
"location"=>{"name"=>"hhuih", | |
"cached_slug"=>"", | |
"description"=>"bhkhk", | |
"location_images_attributes"=>{"0"=>{"caption"=>"safs", | |
"photo"=>#<ActionDispatch::Http::UploadedFile:0x00000003c375c8 @original_filename="sshot1.png", | |
@content_type="image/png", | |
@headers="Content-Disposition: form-data; name=\"location[location_images_attributes][0][photo]\"; filename=\"sshot1.png\"\r\nContent-Type: image/png\r\n", | |
@tempfile=#<File:/tmp/RackMultipart20110725-27866-f7hzdx>>}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GET /locations/new¬ | |
# GET /locations/new.xml¬ | |
def new¬ | |
@location = Location.new¬ | |
3.times {@location.location_images.build} ¬ | |
respond_to do |format|¬ | |
format.html # new.html.erb¬ | |
format.xml { render :xml => @location }¬ | |
end¬ | |
end¬ |
NewerOlder