rhtml

how to configure tomcat to handle rhtml pages using jruby?

How can I configure tomcat to handle .rhtml pages with jruby? I guess I should mess around with the web.xml file, but I don't know how... (ideally, without rails, just the necessary stuff to use erb for rendering rhtml pages...) ...

What are some tips for debugging Ruby erb files?

Currently, when I get an error on an erb template (for use with HTTPServer/cgi) I do the following: If it's a small change, revert, save and retest. For a large change or new file, delete or comment 1/2 the code, and retest. Perform a binary search until I've deleted/found the broken code. The call stack doesn't seem to correspond t...

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 to reduce the number of <% %> and <%= %> tags I use. The following seems bloated: Exa...

Simple question about an if block in Ruby on Rails

Hi, 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 %> <div id="comments"> <h2>Comments</h2> <%= render :partial => @statemant.comments %> </div> <% end %> ...

How to access html request parameters for a .rhtml page served by webrick?

I'm using webrick (the built-in ruby webserver) to serve .rhtml files (html with ruby code embedded --like jsp). It works fine, but I can't figure out how to access parameters (e.g. http://localhost/mypage.rhtml?foo=bar) from within the ruby code in the .rhtml file. (Note that I'm not using the rails framework, only webrick + .rhtml fil...

Rendering a variable with erb.

I've got the following problem: I have rhtml (html minced together with ruby inside <% %> and <%= %> tags) stored in a database which I want to render. The information is acquired through a query. I need to be able to evaluate the information I get from the database as though as it was normal content inside the .erb-file. What I currentl...

How do can I have a dropdown list(select HTML) where i want to have one of the options where i allow the user to enter a user specif entery?

Hi I want to have a drop down menu where a user can select from several predefined options but i also want to give him the option of inserting a user specific value, i was thinking having one of the options as "user specific" which will in turn allow the user to insert a user specif entry in a text box that appears or is editable when u...

Radio Button won't work in internet explorer but works fine in firefox

Hi I have HTML code like so: function toggle_action(type) { var tabs = document.getElementsByName("action_tab") for(var i = 0 ; i < tabs.length; i++){ //alert(" i = " + i + " length=" + tabs.length ); if(tabs[i].id == type.value){ tabs[i].style.display='inline'; }else{ tabs[i].style.display='none'; } }; ...

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... %> <% end %> but I get a NoMethodError for detail.time_zone. What's the correct syntax fo...

Error when following RoR Video

Hi, 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 ')' "jquery-ui-1.8.2.min", "application").to_s); @output... I have followed this rail...

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 homepage is rendered it retrieves the information for the news widget from the file? than...

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

Hi 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 box is "dog" then after clicking the button the URL should be "/go_somwhere?value=dog"...

RHTML to string - rails

Hi, everyone. 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 solution, but one thing bugs me. I need to write this html code inside the doub...