Thoughts, information and reflections about technology


Ruby on Rails Tips including general tips and specific coding methods.


1 2 3 5

Using Always Up to run Ruby on Rails Puma Servers as a service on Microsoft IIS servers.

When I first began Ruby on Rails development, I was not able to use a LAMP stack. I was limited to working with the existing Microsoft IIS server.

 I chose Puma as the Rails production server for the applications. The problem was that if the IIS server was restarted, which happened often, the individual applications would need to be manually restarted. This simply was not acceptable.

Continue reading

Parenthesis in a Rails radio_button_tag was preventing onclick javascript from working.

I was working with some existing code where I needed to add an onclick javascript event.

I couldn’t even get an alert box to work. After a good bit of trial and error, I found the reason. I put in a line of radio button code from the www3 school’s try it and it worked. After closer inspection, I found that the original radio button had parenthesis. Continue reading

Running Rails Console in production while using Spring

This one drove me nuts for a couple of hours. I needed to modify the contents of the user table in a rails app using rails console.

After a bit of trying it seemed that I was running the rails console in development mode. So, I tried the obvious rails console production.   After checking the tables, I found I was still in the development mode. Continue reading

Validating CSV imports in Rails

I needed to validate CSV files that were being imported into a Rails app. The validation was simple: Look for blank entries, ensure columns used for associations (IDs) were integers and check that certain other entries were numeric.

The first thing I checked was to make sure that the header of the CSV file matched what we expected. The simplest way to do this was to set an ‘expected header’ and then check the header on the CSV. Continue reading

Render layout position in a method

Where you place your render layout in your method matters.

I was debugging a piece of code that definitely was not giving me the results I expected.  I was using a render layout with an alternate style instead of application.html.erb since this was a popup. I did not need the headers, footers and navigation in the popup.  I included the following in my edit method:

Continue reading

Rails – Passing several discrete items to a ..each do |xxx|

I had a situation where I wanted to pass a handful of objects to an .each do in Rails such as the points of the compass.

I didn’t find any useful documentation on how to do that. It dawned on me that I could probably set up a simple array and add the .each do to it. 

Below is a sample of how this word work in a view.  Continue reading

1 2 3 5
Contact me