Ajax on rails

I need som help i want tha a hole

to have a link to remote
to a
controllers action (yo do click on any part inside th div and the action
is
executed)
how can i do that!!


Felipe V. Contesse
Ingeniería Civil Industrial UC

Felipe V. wrote:

I need som help i want tha a hole

to have a link to remote
to a controllers action (yo do click on any part inside th div and the
action is executed)
how can i do that!!

Put everything inside the div into a partial. Put the link_to_remote
around the
partial, like this:

<%= link_to_remote render(:partial => ‘my_partial’), :url => {…} %>

I suspect you’ll get an with an entire stretch of HTML inside, not
just a
string. Report back if the link_to_remote calls h() on the HTML!


Phlip

i will try that thank yo very much!!

On Sat, Sep 6, 2008 at 10:14 AM, Phlip [email protected] wrote:

partial, like this:


Felipe V. Contesse
Ingeniería Civil Industrial UC

Felipe V. wrote:

i will try that thank yo very much!!

Oh yeah and test the living crap out of it, preferably with
assert_xpath,
because it’s going to be a major hazard at code upgrade time!

  <%= link_to_remote render(:partial => 'my_partial'), :url => {...} %>

Felipe V. wrote:

i didnt understant the assert_xpath

 >       <%= link_to_remote render(:partial => 'my_partial'), :url
=> {...} %>

When you test that, it will produce an , so capture that. First put a

<div id='clickable_div' around the linker. Then capture it like this:

assert_tag_id :div, :clickable_div do
assert_xpath ‘a’ do |a|
assert{ a[:href] == ‘#’ }
puts indent_xml
end
end

When you run that test, the puts indent_xml will spew out the contents
of the
partial inside the .

Then you can call assert_tag_id or assert_xpath, again, to find some
detail
inside the partial.

This way, a change that looks harmless, to the or the partial, has
greater
odds of raising a red flag instantly, while testing.


Phlip

i didnt understant the assert_xpath

thak you anyway i will check for information!!!

On 9/6/08, Phlip [email protected] wrote:

%>

--
  Phlip


Felipe V. Contesse
Ingeniería Civil Industrial UC

thank you very much!!

On 9/7/08, Phlip [email protected] wrote:

id=‘clickable_div’ around the linker. Then capture it like this:
partial inside the .


Felipe V. Contesse
Ingeniería Civil Industrial UC