Tag Archive: linkedin

Configuring Rails 3.1.3 under Sub-URI

In setting up a new Rails app recently I was told that it needed to be served under the sub-URI of ‘/info’. I hadn’t done this before with a Rails app, and I expected that it could be tricky. I checked online to see how this is done and found references to the ‘relative_url_root’ setting,…

Troubleshooting ActiveResource Requests

I’m currently working on an app which integrates with the HighRise API using the Highrise Ruby wrapper gem. The classes defined by the gem rely on ActiveResource, the Ruby library included with Rails for interfacing with RESTful resources like the HighRise API. Sometimes I’m not sure if the requests being made via the commands I’m…

Example Rake Task

Here is example rake task code which you can use and modify the next time you’re setting up new Rake tasks for a Rails app from scratch. The example includes the syntax for setting the default task, running multiple tasks in order, and a task which includes multiple arguments. This coding syntax works with Rails…

Adding a New User in Ubuntu

Adding User When setting up a new website manually on an Ubuntu server you need to establish a user account with a home directory, and Bash shell access to the server. useradd -m testuser -s /bin/bash After creating the account you’ll want to assign a password for the account. passwd testuser

Resolving issues with Namespaced Models in Rails 3.1.0

I recently was tasked with upgrading an application from Rails 2.3.8 to Rails 3. I choose to upgrade it to Rails 3.1, because why upgrade once and then have to do it again later. After upgrading and testing many points of the system locally, I was ready to push the upgraded application to the production…

Paperclip error with non-image file

Recently I updated to Rails 3.1 from 2.3.8 for a project I’m working on. Paperclip version 2.4.5 was working perfectly well for me locally on my Mac OS X 10.7.2 laptop, with ImageMagick version 6.7.3-1. We had just launched the upgraded Rails 3.1 application to our production server, which went smoothly, but upon my checklist of…

Issues with RVM

I recently decided to check out BrowserCMS, to evaluate how it work and decide to use it…or RefineryCMS. I didn’t expect that BrowserCMS would require Ruby 1.9.2. I’ve been running with Ruby 1.8.6 or 1.8.7 for quite a while now without any issues. It looks like it was time that I install RVM: Ruby Version Manager….

Redirect_to not working

I was just working on a Ruby on Rails controller method that receives information from the previous form via HTTP POST. I coded it so that if certain form variables weren’t present it would set a flash message and redirect to the form page. I tried and tried and still the redirect wasn’t working. I…

Advanced Use of Will_Paginate

I’m building an index of contacts, displayed with paginated links provided by will_paginate. The wiki for this plugin advises you on how to do setup your controller method, and what to put in the view to obtain a simple set of links, such as: # /app/controllers/contact_controller.rb def index @contacts = Contact.paginate :page => params[:page], :per_page…

Ruby on Rails session – Access from PHP

If you need to access a Ruby on Rails session from a PHP application running under the same domain, you can do this by splitting the string in the cookie by the ‘–’. Thanks to Frederick Cheung for pointing this out. Here is coding I added to my PHP script which was running from a…