Questions tagged [rhtml]

HTML-files, with ruby code embedded.

HTML-files, with ruby code embedded, similar to [JSP].

RHTML is HTML mixed with Ruby, using HTML tags. All of Ruby is available for programming alongwith HTML:

Following is the syntax of using Ruby with HTML:

<% %> # executes the Ruby code <%= %> # executes the Ruby code and displays the result

The output of anything in <%= %> tags is directly copied to the HTML output stream. To secure against HTML injection, use the h() function to html_escape the output

For example::

31 questions
1
vote
6 answers

How to output text in rthml without <%=variable%>

I've been looking around for a solution to this question for the last couple of days. It's a simple annoyance, but I hate not knowing how to do things... Environment: Ruby, Rails, rhtml The Problem: When I iterate a collection in rhtml I would like…
Chadwick
  • 283
  • 1
  • 2
  • 8
0
votes
1 answer

Count how many methods are in a method?

So if there are two methods: def foo method1 method2 end How could one check to see if all of these 'method1/method2' have been executed in the method themselves? How could the amount of times that the method is being called being counted.…
Scott Nicol
  • 11,458
  • 3
  • 15
  • 8
0
votes
1 answer

!map:HashWithIndifferentAccess value convert and display at rhtml in Rails

From MySQL database I got params in this format. Now I am unable to access this data. I have taken this value in variable. Code: @text = --- !map:HashWithIndifferentAccess q5_areaOf: - Mathematics - Commerce q7_residenceCity: Indore q6_email:…
Rubyist
  • 6,486
  • 10
  • 51
  • 86
0
votes
1 answer

TOC in Rhtml malfunctioning

I am knitting my Rmd file into HTML. Since there are a lot of codes in my Rmd file, I did the following so that my reader can navigate to a certain section within the HTML file: --- title: "xxx" author: "xxx" date: "xx/xx/xx" output: …
RofyRafy
  • 73
  • 1
  • 7
0
votes
1 answer

Mongrel: how to process erb in .rhtml file

I am trying to serve up static content for some web development, with a few lines of erb to simulate what the real server will do. I already did this with WEBrick here:…
mydoghasworms
  • 18,233
  • 11
  • 61
  • 95
0
votes
2 answers

Getting a value from Javascript on Ruby

<%= l.text_field :run_time, :class => "line_item_run_time" %> Hello. I have rhtml code, l.text_field :run_time, has a value in its textbox that I need to use and I want to store it in a variable, if for example I do…
Luis Vivas
  • 51
  • 1
  • 6
0
votes
1 answer

Converting .rhtml views to .html.erb, etc

In migrating an old Rails app to 2.3.10, I ran across this blog post that has a nice rake task to convert .rhtml files to .html.erb, .rjs to .js.rjs, .haml to .html.haml, etc. However, when I ran it I found that the partials hadn't be updated,…
jrdioko
  • 32,230
  • 28
  • 81
  • 120
0
votes
1 answer

RHTML to string - rails

In my rails application my models have a to_html method. This method is called in one of the views so the model's attributes can be displayed properly regardless of their classes (because all of my classes implement that method) That is a neat…
Renan
  • 1,910
  • 4
  • 22
  • 36
0
votes
2 answers

adding value of input box to URL as a param after a button is pressed?

I have one input field and 2 buttons, each button performs a different function. i want one of the buttons to take the value of the input field and add it to a specified Url (as a param) that button should go to. so if the value inserted in to the…
Mo.
  • 40,243
  • 37
  • 86
  • 131
0
votes
4 answers

Updating webpage widget without changing code?

HI I would like to have latest news/updates in the homepage of my website but i don't want to have to change the HTML code every time i want add a new news line or make a change, is there anyway i can make a file that i can just edit and when the…
Mo.
  • 40,243
  • 37
  • 86
  • 131
0
votes
1 answer

Error when following RoR Video

I keep getting this error compile error /Users/dean/src/carolian/app/views/layouts/events.html.erb:10: syntax error, unexpected ',', expecting ')' /Users/dean/src/carolian/app/views/layouts/events.html.erb:11: syntax error, unexpected ',', expecting…
Dean
  • 8,668
  • 17
  • 57
  • 86
0
votes
2 answers

How do I use a nested attribute with a form_for 's select method?

We have a user model which :has_one detail. In a form_for a user, I want a drop-down to select the user's details' time_zone. I've tried <% form_for @user do |f| %> ... user stuff ... <%= f.select :"detail.time_zone", ...other args...…
Simon
  • 25,468
  • 44
  • 152
  • 266
0
votes
1 answer

Timestamp in rhtml

I'm trying to show timestamp on .rhtml page, but it returns something like this: Mon Dec 09 21:03:22 +0400 2013 How it should be: 2013.12.09 21:03:22 What's wrong? This is how I do: <%= message.time %>
0
votes
1 answer

Simple question about an if block in Ruby on Rails

I am trying to tell ruby to not run a block of html and ruby if no active record exists in the database. Below is the code I was trying to run conditions on. <% if @statemant.comments.exists?() do %>

Comments

<%=…
user247215
0
votes
1 answer

RApache server downloads *.rhtml files, instead of execute it

I'm developing an R web application using RApache. I have finished all the application and it runs correctly in my local server. But I have a problem when I port it to the university's server: the .rhtml files, where are the R-scripts; are…