Search code examples
ruby-on-railscoffeescripthamllink-tohamlc

Rails, HAML, using a link_to


here's what I'm trying to do: Example of HAML/Rails thing I'm trying to do

That 'Request Key: ' part should actually be a 6-digit value, e.g.

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.....


Solution

  • Use:

    %li
      Request Key:
      = link_to @request.name, request_path(@request.name)