Try adding :with => "''variable='' + value" after
the URL info. You can
code the variable name (such as "section="), but you''ll need
to find a
way to get the section name into the place of "value" above. That
will depend on how you''re creating your links.
In the end, this should (hopefully) work for one link:
<%= link_to_remote "sports",
:update => ''news_div'',
:url => {:action => "getinfo"},
:with => "''section='' +
''sports''" %>
Looking at it again, you could probably use :with =>
"section=#{link.section}" for better readability.
-Kyle
On May 13, 9:10 am, Leo Kowalsky
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi
>
> My problem is the following.
> I have to describe a sort of a "news" page. (I just have to give
the
> basic architecture)
>
> I want to refresh a <div> acording to the name of the link cliked.
>
> my code looks like this :
>
> *********************************************
> <%= link_to_remote "sports",
> :update => ''news_div'',
> :url => {:action => "getinfo"} %>.<br/>
> <div id=''news_div''>
> </div>
> *********************************************
>
> I have a "getinfo" method in my controller to get the news and
fill the
> div. But how do I pass an argument to "getinfo" to get specific
news?
>
> I would like to do for example in pseudocode :
>
> getinfo("sports")
> getinfo("international")
> getinfo("finance")
>
> Basicaly I want to pass the name of the link as argument to the
> "getinfo" method.
>
> can anyone show me:
> the syntax for my "link_to_remote" link and the syntax for the
getinfo
> method of my controller so that it allows to take an argument?
>
> this would be a great help !
>
> thanx
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---