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
def update | |
milestone = @project.milestones.find(params[:id]) | |
params[:milestone]['invoice_on_completion'] = "0" unless params[:milestone]['invoice_on_completion'] | |
if milestone.update_attributes(params[:milestone]) | |
respond_to do |format| | |
format.js { render :json => milestone } | |
end | |
else |
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
MilestoneModel = Backbone.Model.extend({ | |
initialize: function(attrs) { | |
this.hasMany('Tasks', 'milestone_id'); | |
} | |
}); | |
TaskModel = Backbone.Model.extend({ | |
initialize: function(attrs) { | |
this.belongsTo('Milestones', 'milestone_id'); |
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
$.extend(Backbone.Model.prototype, { | |
hasMany: function(collectionName, associationColumn, opts) { | |
var parent = this, | |
associationName = (collectionName.substr(0, 1).toLowerCase() + collectionName.substr(1)), | |
options = $.extend({ parentId: 'id' }, opts), | |
collection; | |
this[associationName] = function() { | |
collection = window[collectionName].select(function(child) { | |
return child.get(associationColumn) == parent.get(options['parentId']); |
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
MilestoneSet = Backbone.Collection.extend({ | |
model: MilestoneModel, | |
initialize: function() { | |
this.bind('add', function(model) { | |
new ProjectView({ model: model }); | |
}); | |
} | |
}); |
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 addWeeks(myDate, weeks) { | |
days = weeks * 7; | |
return new Date(myDate.getTime() + days*24*60*60*1000); | |
} | |
date = new Date(Date.parse('Mar 28, 2011')); | |
addWeeks(date, 1); | |
// This is returning Sun Apr 03 when it should be Mon Apr 04 |
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
render: function() { | |
// Initialize the template | |
if (this.template == null) { this.template = Haml($('#task_template').html()); } | |
// Update the template based on the model's attributes | |
$(this.el).html(this.template(this.model.viewAttributes())); | |
// Insert the template into the DOM if it doesn't already exist | |
if ($('#' + this.id).length == 0) { | |
$(this.model.milestone.view.el).after(this.el); |
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
[2010-08-18 09:42:47] GEM_PATH=/Users/scott/.rvm/gems/ruby-1.8.7-p302:/Users/scott/.rvm/gems/ruby-1.8.7-p302@global GEM_HOME=/Users/scott/.rvm/gems/ruby-1.8.7-p302 BUNDLE_PATH=/Users/scott/.rvm/gems/ruby-1.8.7-p302 /Users/scott/.rvm/rubies/ruby-1.8.7-p302/bin/ruby /Users/scott/.rvm/src/rubygems-1.3.7/setup.rb | |
[2011-03-11 11:26:19] GEM_PATH="/Users/scott/.rvm/gems/ruby-1.8.7-p302:/Users/scott/.rvm/gems/ruby-1.8.7-p302@global:/Users/scott/.rvm/gems/ruby-1.8.7-p302@global" GEM_HOME="/Users/scott/.rvm/gems/ruby-1.8.7-p302" BUNDLE_PATH="/Users/scott/.rvm/gems/ruby-1.8.7-p302 /Users/scott/.rvm/rubies/ruby-1.8.7-p302/bin/ruby" "/Users/scott/.rvm/src/rubygems-1.3.7/setup.rb" | |
: line 282: /Users/scott/.rvm/src/rubygems-1.3.7/setup.rb: Permission denied | |
[2011-03-11 11:27:46] GEM_PATH="/Users/scott/.rvm/gems/ruby-1.8.7-p302:/Users/scott/.rvm/gems/ruby-1.8.7-p302@global:/Users/scott/.rvm/gems/ruby-1.8.7-p302@global" GEM_HOME="/Users/scott/.rvm/gems/ruby-1.8.7-p302" BUNDLE_PATH="/Users/scott/.rvm/gems/ruby-1.8.7-p302 /Us |
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
$ rvm rubygems current | |
Removing old Rubygems files... | |
Installing rubygems dedicated to ruby-1.8.7-p302... | |
Installing rubygems for /Users/scott/.rvm/rubies/ruby-1.8.7-p302/bin/ruby | |
Error running 'GEM_PATH="/Users/scott/.rvm/gems/ruby-1.8.7-p302:/Users/scott/.rvm/gems/ruby-1.8.7-p302@global:/Users/scott/.rvm/gems/ruby-1.8.7-p302@global" GEM_HOME="/Users/scott/.rvm/gems/ruby-1.8.7-p302" BUNDLE_PATH="/Users/scott/.rvm/gems/ruby-1.8.7-p302 /Users/scott/.rvm/rubies/ruby-1.8.7-p302/bin/ruby" "/Users/scott/.rvm/src/rubygems-1.3.7/setup.rb"', please check /Users/scott/.rvm/log/ruby-1.8.7-p302/rubygems.install.error.log | |
Installation of rubygems did not complete successfully. |
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
tell application "Terminal" | |
activate | |
end tell | |
tell application "TextMate" | |
activate | |
end tell |
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
tell application "Firefox" | |
activate | |
end tell | |
tell application "System Events" | |
tell process "Firefox" | |
keystroke "r" using {command down} | |
end tell | |
end tell |