typos and style tweaks

This commit is contained in:
Darren Cato 2013-07-23 01:28:43 -04:00
parent 3450c22e97
commit 2e13affdce
3 changed files with 6 additions and 6 deletions

View file

@ -33,7 +33,7 @@ class DataController < ApplicationController
when 'todos' when 'todos'
@labels = [:description, :context, :project, :notes, :created_at, :due, :completed_at] @labels = [:description, :context, :project, :notes, :created_at, :due, :completed_at]
else else
flash[:error] = "Ivalid import desitination" flash[:error] = "Invalid import destination"
redirect_to :back redirect_to :back
end end
respond_to do |format| respond_to do |format|

View file

@ -137,7 +137,7 @@ class Project < ActiveRecord::Base
@age_in_days ||= (Date.today - created_at.to_date + 1).to_i @age_in_days ||= (Date.today - created_at.to_date + 1).to_i
end end
def self.import params, user def self.import(params, user)
count = 0 count = 0
CSV.foreach(params[:file], headers: true) do |row| CSV.foreach(params[:file], headers: true) do |row|
unless find_by_name_and_user_id row[params[:name].to_i], user.id unless find_by_name_and_user_id row[params[:name].to_i], user.id
@ -151,7 +151,7 @@ class Project < ActiveRecord::Base
end end
end end
count count
end end
end end

View file

@ -1,6 +1,6 @@
class Todo < ActiveRecord::Base class Todo < ActiveRecord::Base
MAX_DESC_LENGTH = 300 MAX_DESCRIPTION_LENGTH = 300
MAX_NOTES_LENGTH = 60000 MAX_NOTES_LENGTH = 60000
before_save :render_note before_save :render_note
@ -434,7 +434,7 @@ class Todo < ActiveRecord::Base
end end
end end
def self.import params, user def self.import(params, user)
default_context = Context.where(:user_id=>user.id).order('id').first default_context = Context.where(:user_id=>user.id).order('id').first
count = 0 count = 0
@ -455,6 +455,6 @@ class Todo < ActiveRecord::Base
end end
end end
count count
end end
end end