Skip to content

Commit

Permalink
search for parent to remove in remove_link using $.parents, not $.par…
Browse files Browse the repository at this point in the history
…ent (Gopal Patel)
  • Loading branch information
jamesgolick committed Jun 2, 2008
1 parent a105310 commit 775a729
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/attribute_fu/associated_form_helper.rb
Expand Up @@ -54,7 +54,7 @@ def remove_link(name, *args)
css_selector = options.delete(:selector) || ".#{@object.class.name.split("::").last.underscore}"
function = options.delete(:function) || ""

function << "$(this).parent(&quot;#{css_selector}&quot;).remove()"
function << "$(this).parents(&quot;#{css_selector}&quot;).remove()"

@template.link_to_function(name, function, *args.push(options))
end
Expand Down
6 changes: 3 additions & 3 deletions test/test/unit/associated_form_helper_test.rb
Expand Up @@ -76,7 +76,7 @@ def setup
end

should "infer the name of the current @object in fields_for" do
assert_match "$(this).parent(&quot;.comment&quot;).remove()", @erbout
assert_match "$(this).parents(&quot;.comment&quot;).remove()", @erbout
end
end

Expand All @@ -86,7 +86,7 @@ def setup
end

should "use the alternate selector" do
assert_match "$(this).parent(&quot;.blah&quot;).remove()", @erbout
assert_match "$(this).parents(&quot;.blah&quot;).remove()", @erbout
end
end

Expand All @@ -97,7 +97,7 @@ def setup
end

should "still infer the name of the current @object in fields_for, and create the function as usual" do
assert_match "$(this).parent(&quot;.comment&quot;).remove()", @erbout
assert_match "$(this).parents(&quot;.comment&quot;).remove()", @erbout
end

should "append the secondary function" do
Expand Down

0 comments on commit 775a729

Please sign in to comment.