10

In PHP, it is possible to do this:

<input type="text" value=" <?php echo "Hello world"; ?> ">

Is it possible to embed Ruby in HTML like that with or without Rails?

3 Answers 3

6

You will need to use a templating engine like Ruby Templates (ERB). Here's an example. Rails uses ERB so you could easily do this in each of your templates.

Sign up to request clarification or add additional context in comments.

1 Comment

Original link was dead (expected 10+ later). I replaced with the archive.org version
1

Rails has something called ERB to do just this sort of thing.

Comments

1

Use HAML for HTML templating, otherwise ERB.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.