mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
activerecord associations do not act like a collection anymore, so convert to array first
before using map, collect, etc.
This commit is contained in:
parent
85cfa1c366
commit
49a09f36e8
4 changed files with 9 additions and 9 deletions
|
@ -238,7 +238,7 @@ module TodosHelper
|
|||
|
||||
def remote_toggle_checkbox(todo=@todo)
|
||||
check_box_tag("mark_complete_#{todo.id}", toggle_check_todo_path(todo), todo.completed?, :class => 'item-checkbox',
|
||||
:title => todo.pending? ? t('todos.blocked_by', :predecessors => todo.uncompleted_predecessors.map(&:description).join(', ')) : "", :readonly => todo.pending?)
|
||||
:title => todo.pending? ? t('todos.blocked_by', :predecessors => todo.uncompleted_predecessors.to_a.map(&:description).join(', ')) : "", :readonly => todo.pending?)
|
||||
end
|
||||
|
||||
def remote_mobile_checkbox(todo=@todo)
|
||||
|
@ -251,7 +251,7 @@ module TodosHelper
|
|||
if todo.completed?
|
||||
content_tag(:span, {:class => :grey}) { format_date( todo.completed_at ) }
|
||||
elsif todo.pending?
|
||||
title = t('todos.depends_on')+ ": " + todo.uncompleted_predecessors.map(&:description).join(', ')
|
||||
title = t('todos.depends_on')+ ": " + todo.uncompleted_predecessors.to_a.map(&:description).join(', ')
|
||||
content_tag(:a, {:title => title}) { content_tag(:span, {:class => :orange}) { t('todos.pending') } }
|
||||
elsif todo.deferred?
|
||||
show_date( todo.show_from )
|
||||
|
@ -263,7 +263,7 @@ module TodosHelper
|
|||
def successors_span(todo=@todo)
|
||||
unless todo.pending_successors.empty?
|
||||
pending_count = todo.pending_successors.count
|
||||
title = "#{t('todos.has_x_pending', :count => pending_count)}: #{todo.pending_successors.map(&:description).join(', ')}"
|
||||
title = "#{t('todos.has_x_pending', :count => pending_count)}: #{todo.pending_successors.to_a.map(&:description).join(', ')}"
|
||||
image_tag( 'successor_off.png', :width=>'10', :height=>'16', :border=>'0', :title => title )
|
||||
end
|
||||
end
|
||||
|
@ -277,7 +277,7 @@ module TodosHelper
|
|||
end
|
||||
|
||||
def tag_list_text(todo=@todo)
|
||||
todo.tags.join(', ')
|
||||
todo.tags.to_a.join(', ')
|
||||
end
|
||||
|
||||
def tag_span (tag, mobile=false)
|
||||
|
|
|
@ -159,7 +159,7 @@ function block_predecessors(next_steps) {
|
|||
function regenerate_predecessor_family(next_steps) {
|
||||
<%
|
||||
if @predecessors
|
||||
parents = @predecessors
|
||||
parents = @predecessors.to_a
|
||||
until parents.empty?
|
||||
parent = parents.pop
|
||||
parents += parent.predecessors -%>
|
||||
|
|
|
@ -125,7 +125,7 @@ function update_predecessors(next_steps) {
|
|||
|
||||
function regenerate_predecessor_family() {
|
||||
<%
|
||||
parents = @todo.predecessors
|
||||
parents = @todo.predecessors.to_a
|
||||
until parents.empty?
|
||||
parent = parents.pop
|
||||
parents += parent.predecessors
|
||||
|
|
|
@ -9,10 +9,10 @@ module IsTaggable
|
|||
has_many :taggings, :as => :taggable
|
||||
has_many :tags, :through => :taggings do
|
||||
def to_s
|
||||
self.map(&:name).sort.join(Tag::JOIN_DELIMITER)
|
||||
self.to_a.map(&:name).sort.join(Tag::JOIN_DELIMITER)
|
||||
end
|
||||
def all_except_starred
|
||||
self.reject{|tag| tag.name == Todo::STARRED_TAG_NAME}
|
||||
self.to_a.reject{|tag| tag.name == Todo::STARRED_TAG_NAME}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -31,7 +31,7 @@ module IsTaggable
|
|||
|
||||
# Transactions may not be ideal for you here; be aware.
|
||||
Tag.transaction do
|
||||
current = tags.map(&:name)
|
||||
current = tags.to_a.map(&:name)
|
||||
_add_tags(list - current)
|
||||
_remove_tags(current - list)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue