Skip to content

Commit

Permalink
DRYML -- fix to part IDs when the context is an array with unknown or…
Browse files Browse the repository at this point in the history
…igin
  • Loading branch information
tslocke committed Jul 7, 2008
1 parent 91028e9 commit d1a4bb7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
9 changes: 1 addition & 8 deletions hobo/lib/hobo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,7 @@ def to_url_path
end

def typed_id
origin_id = origin.try.typed_id
"#{origin_id}_#{origin_attribute}" if origin_id
origin and origin_id = origin.try.typed_id and "#{origin_id}_#{origin_attribute}"
end

end
Expand All @@ -474,10 +473,4 @@ class ActiveRecord::NamedScope::Scope
end


class NilClass
def typed_id
"nil"
end
end

Hobo.enable if defined?(Rails)
5 changes: 2 additions & 3 deletions hobo/lib/hobo/dryml/template_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ def dom_id(object=nil, attribute=nil)
object = this
end
end

id = object.try.typed_id
if id

if (id = object.try.typed_id)
attribute ? "#{id}_#{attribute}" : id
else
"nil"
Expand Down

0 comments on commit d1a4bb7

Please sign in to comment.