Ask coding questions

← Back to all posts
How to access backend vars on the frontend in Ruby
JacobMcPherson1

How would I access the visitor's var in my index.html file?

Answered by CodingCactus [earned 5 cycles]
View Answer
Voters
JacobMcPherson1
Comments
hotnewtop
CodingCactus

you should use erb files, not html ones

A little example:

main.rb

public/index.erb

If you need some explanation, let me know!

JacobMcPherson1

@CodingCactus It works fine, but can you explain what an erb file is? Thank you!

CodingCactus

@JacobMcPherson1 you may want to google it as I'm not very good at explaining it, but basically it's like ejs but ruby

JacobMcPherson1

@CodingCactus oooh, ok. Thanks again