mercredi 24 janvier 2018

How to render a value from an .rb file into an .erb file

I don't have much experience with Ruby all I wan't to do is render a value that I declare in an .rb file in an .erb file.

In my .rb file I have this:

def abc()
  begin
     "aaaaa"
  end
end

In my .erb file I have this:

Hello <% abc %>

When I run the app I only see:

Hello

But I expect to see:

Hello aaaa

Anybody can give me a hand, I don't really know ruby at all. Also I have no idea if this is ruby or ruby on rails so sorry if the tag below is wrong.

Aucun commentaire:

Enregistrer un commentaire