That 'Request Key: '
part should actually be a 6-digit value, eg
Request Key: 614551
And the 'PCN: '
part is similar, it should be:
PCN: MEDDAET
Clicking on MEDDEAT would open a route that would search on that MEDDEAT value in the :foo_bar
column.
The code I'm trying isn't working, and I don't know enough HAML to know why.
%li Request Key: = link_to #{@request.name}, request_path(@request.name)
and
%li = link_to "request.pcn", :controller => filter_plans, :q => {:plan_aliases_PlanAlias_cont => @pcn}}
As you can se, that code just renders as text, not a link. I'd appreciate help on what I'm doing wrong here with the HAML code.
EDIT: This is a HAMLC file. Coffeescript! GRRRRRR.....
%li
Request Key: #{link_to @request.name, request_path(@request.name)}
Use:
%li
Request Key:
= link_to @request.name, request_path(@request.name)
%li
= "Request Key: #{link_to(@request.name, request_path(@request.name))".html_safe
this will works with rails
Here was the answer, because it was HAMLC, not HAML (ie it compiles through coffeescript and not Rails, therefore Rails helpers didn't work).
%li Request Key:
%a{ :href => '/requests/#{ @name }', :target => '_blank'} #{@name}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.