Forum: Ruby on Rails pass name and values in link_tag

98035f2826f1c962799e023da10d5f77?d=identicon&s=25 kanna (Guest)
on 2013-07-29 17:05
(Received via mailing list)
hi i passed name and value in link_to but its not taking?

<%if params[:deals][:company_name] !=nil &&
params[:deals][:company_name]
== "dsec" %>
            <%= link_to "Company Name
d","javascript:void(0)",:class=>"get_page
decending",:name=>"deals[company_name]",:value=>"asc","data-url"=>"1","data-searchurl"=>"/deals/search"
%>
            <%elsif params[:deals][:company_name] !=nil &&
params[:deals][:company_name] == "asc"%>
            <%= link_to "Company Name
a","javascript:void(0)",:class=>"get_page
ascending",:name=>"deals[company_name]",:value=>"dsec",
"data-url"=>"1","data-searchurl"=>"/deals/search" %>
            <%else%>
            <%= link_to "Company Name n","javascript:void(0)",:
class=>"get_page",:name=>"deals[company_name]",:value=>"
dsec","data-url"=>"1","data-searchurl"=>"/deals/search" %>
            <%end%>


in browser
<a class="get_page" value="dsec" name="deals[company_name]" data-url="1"
data-searchurl="/deals/search" href="javascript:void(0)">Company
Name n</a>


how to pass name and value to link_to tag?

thanks
kanna
Bdf1f2ad97e7b9c9db1fa70e3cef48bf?d=identicon&s=25 bacrossland (Guest)
on 2013-07-29 17:56
(Received via mailing list)
On Monday, July 29, 2013 10:03:47 AM UTC-5, kanna wrote:

> ascending",:name=>"deals[company_name]",:value=>"dsec",
> Name n</a>
>
>
> how to pass name and value to link_to tag?
>
> thanks
> kanna
> ---------
>

Hi Kanna,

Your issue looks to be a simple typo. You need to remove the quotes from
around your variable specification.

:name=>"deals[company_name]"
 should be
:name=>deals[company_name]
or
:name=>"#{deals[company_name]}"

Thanks,
Bryan
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.