0

This line works:

<%= link_to "About", pages_about_path, :class => "name" %>

while this doesn't:

<%= link_to "About", pages_about_path, class : "name" %>

Aren't both equivalent hash notations? The examples shown in the Rails API docs also use the second notation.

sawa
  • 165,429
  • 45
  • 277
  • 381
Jatin
  • 14,112
  • 16
  • 49
  • 78

1 Answers1

4

You put one unnecessary space between class and :. So try the following:

 { class: "name"}

Corrected one:-

<%= link_to "About", pages_about_path, class: "name" %>
user229044
  • 232,980
  • 40
  • 330
  • 338
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317