mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 07:10:12 +01:00
Fix syntax errors for upgrade of Rails version
This commit is contained in:
parent
7f567862d7
commit
86e36b07a6
9 changed files with 21 additions and 21 deletions
|
|
@ -83,7 +83,7 @@ class ContextsController < ApplicationController
|
|||
end
|
||||
format.xml do
|
||||
if @context.new_record?
|
||||
render_failure @context.errors.to_xml.html_safe, 409
|
||||
render_failure @context.errors.full_messages.to_xml(root: "errors", skip_types: true).html_safe, 409
|
||||
else
|
||||
head :created, :location => context_url(@context)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
format.xml do
|
||||
if @project.new_record?
|
||||
render_failure @project.errors.to_xml.html_safe, 409
|
||||
render_failure @project.errors.full_messages.to_xml(root: "errors", skip_types: true).html_safe, 409
|
||||
else
|
||||
head :created, :location => project_url(@project), :text => @project.id
|
||||
end
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ class TodosController < ApplicationController
|
|||
if @saved
|
||||
head :created, :location => todo_url(@todo)
|
||||
else
|
||||
render_failure @todo.errors.to_xml.html_safe, 409
|
||||
render_failure @todo.errors.full_messages.to_xml(root: "errors", skip_types: true).html_safe, 409
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -438,7 +438,7 @@ class TodosController < ApplicationController
|
|||
rescue ActiveRecord::RecordInvalid => exception
|
||||
record = exception.record
|
||||
if record.is_a?(Dependency)
|
||||
record.errors.each { |key, value| @todo.errors[key] << value }
|
||||
record.errors.each { |key, value| @todo.errors.add(key, value) }
|
||||
end
|
||||
@saved = false
|
||||
end
|
||||
|
|
@ -1192,7 +1192,7 @@ end
|
|||
begin
|
||||
parse_date_per_user_prefs(date)
|
||||
rescue
|
||||
@todo.errors[:base] << error_msg
|
||||
@todo.errors.add(:base, error_msg)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class UsersController < ApplicationController
|
|||
unless user.new_record?
|
||||
render :body => t('users.user_created'), :status => 200
|
||||
else
|
||||
render_failure user.errors.to_xml, 409
|
||||
render_failure user.errors.full_messages.to_xml(root: "errors", skip_types: true), 409
|
||||
end
|
||||
return
|
||||
end
|
||||
|
|
|
|||
|
|
@ -80,11 +80,11 @@ module RecurringTodos
|
|||
end
|
||||
|
||||
def validate_not_blank(object, msg)
|
||||
errors[:base] << msg if object.blank?
|
||||
errors.add(:base, msg) if object.blank?
|
||||
end
|
||||
|
||||
def validate_not_nil(object, msg)
|
||||
errors[:base] << msg if object.nil?
|
||||
errors.add(:base, msg) if object.nil?
|
||||
end
|
||||
|
||||
def validate
|
||||
|
|
@ -100,7 +100,7 @@ module RecurringTodos
|
|||
when "ends_on_end_date"
|
||||
validate_not_blank(end_date, "The end date needs to be filled in for 'Ends on'")
|
||||
else
|
||||
errors[:base] << "The end of the recurrence is not selected" unless ends_on == "no_end_date"
|
||||
errors.add(:base, "The end of the recurrence is not selected") unless ends_on == "no_end_date"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ module RecurringTodos
|
|||
validate_not_nil(show_always?, "Please select when to show the action")
|
||||
validate_not_blank(show_from_delta, "Please fill in the number of days to show the todo before the due date") unless show_always?
|
||||
else
|
||||
errors[:base] << "Unexpected value of recurrence target selector '#{target}'"
|
||||
errors.add(:base, "Unexpected value of recurrence target selector '#{target}'")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ module RecurringTodos
|
|||
|
||||
def validate
|
||||
super
|
||||
errors[:base] << "Every other nth day may not be empty for this daily recurrence setting" if (!only_work_days?) && every_x_days.blank?
|
||||
errors.add(:base, "Every other nth day may not be empty for this daily recurrence setting") if (!only_work_days?) && every_x_days.blank?
|
||||
end
|
||||
|
||||
def get_next_date(previous)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ module RecurringTodos
|
|||
super
|
||||
validate_not_blank(every_x_week, "Every other nth week may not be empty for weekly recurrence setting")
|
||||
something_set = %w{ sunday monday tuesday wednesday thursday friday saturday }.inject(false) { |set, day| set || send("on_#{day}") }
|
||||
errors[:base] << "You must specify at least one day on which the todo recurs" unless something_set
|
||||
errors.add(:base, "You must specify at least one day on which the todo recurs") unless something_set
|
||||
end
|
||||
|
||||
def get_next_date(previous)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue