Remove project_specified_by_name from TodoController

Use TodoCreateParamsHelper instead here and remove the duplication
This commit is contained in:
Matt Rogers 2013-04-26 08:02:47 -05:00
parent 445a0c7602
commit d5dc723ef0

View file

@ -174,7 +174,8 @@ class TodosController < ApplicationController
end
def create_multiple
if project_specified_by_name(params[:project_name])
p = TodoCreateParamsHelper.new(params, prefs)
if p.project_specified_by_name?
project = current_user.projects.where(:name => params[:project_name]).first_or_create
@new_project_created = project.new_record_before_save?
@project_id = project.id
@ -1350,13 +1351,6 @@ class TodosController < ApplicationController
end
end
def project_specified_by_name(project_name)
return false unless params['project_id'].blank?
return false if project_name.blank?
return false if project_name == 'None'
true
end
def context_specified_by_name(context_name)
return false unless params['context_id'].blank?
return false if context_name.blank?