Skip to content

Commit

Permalink
periodically_call_remote does not need data-observe=true
Browse files Browse the repository at this point in the history
  • Loading branch information
erikstmartin authored and stefanpenner committed Jan 27, 2010
1 parent 6a8da20 commit 0215466
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions actionpack/lib/action_view/helpers/ajax_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ def periodically_call_remote(options = {})
attributes = extract_observer_attributes!(options)
attributes["data-periodical"] = true

# periodically_call_remote does not need data-observe=true
attributes.delete('data-observe')

script_decorator(attributes)
end

Expand Down
4 changes: 2 additions & 2 deletions actionpack/test/template/ajax_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ def setup
end

test "periodically_call_remote" do
assert_dom_equal %(<script data-url=\"http://www.example.com/mehr_bier\" data-observe=\"true\" data-update-success=\"schremser_bier\" type=\"application/json\" data-periodical=\"true\"></script>),
assert_dom_equal %(<script data-url=\"http://www.example.com/mehr_bier\" data-update-success=\"schremser_bier\" type=\"application/json\" data-periodical=\"true\"></script>),
periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" })
end

test "periodically_call_remote_with_frequency" do
assert_dom_equal(
"<script data-periodical=\"true\" data-url=\"http://www.example.com/\" data-observe=\"true\" type=\"application/json\" data-frequency=\"2\"></script>",
"<script data-periodical=\"true\" data-url=\"http://www.example.com/\" type=\"application/json\" data-frequency=\"2\"></script>",
periodically_call_remote(:frequency => 2)
)
end
Expand Down

0 comments on commit 0215466

Please sign in to comment.