Bitwise
Bitwise

Reputation: 8461

Implementing rails view helper

I'm trying to make a simple helper but can't seem to get it to run. Here is what I'm doing:

view:

<td><%= assignment.status %></td>

I'm simply iterating through all assignments and trying to call this status method that I have in a helper. Here is the helper:

HELPER

 module AssignmentHelper
  def status(assignment)
    if assignment.finished
      "Finished"
    else
      "Waiting"
    end
  end
end

ERROR

enter image description here

It's telling me status is undefined.. Am I not defining it in the helper? any help would be great...

Upvotes: 0

Views: 54

Answers (1)

Eyeslandic
Eyeslandic

Reputation: 14890

You call it like this.

<td><%= status(assignment) %></td>

Upvotes: 2

Related Questions