Skip to content

John Plummer . com

Stuff I want to remember

  • About
  • Contact

Category: Ruby and Rails

Creating a staging environment on Heroku

If you’re hosting your app on Heroku (possibly even if you aren’t) it is a good idea to create a staging environment also. Heroku has docs on this but the short version for a new app is: heroku create staging-app-name –stack cedar –remote staging(if the app is already on Heroku, just add the remote: git […]

Read More…

February 21, 2012May 14, 2012 John2 Comments

Heroku error with conditional rb-fsevent gem

Using the guard gem to run tests etc in your Rails app normally requires some form of file system monitoring. The monitoring will be OS dependant and rb-fsevent is the gem for OSX. This can be added to the Gemfile conditionally with: gem ‘rb-fsevent’, :require => false if RUBY_PLATFORM =~ /darwin/i Unfortunately when you next […]

Read More…

February 16, 2012February 15, 2012 JohnNo Comments

Optional Parameters in View Partials

It’s generally good practise to pass variables to view partials using locals rather than littering your code with @variables. This allows better reuse of the partial. To make the locals optional, provide default values if they are nil or undefined. I have seen many recommendations to do this with a test for defined? According to […]

Read More…

January 31, 2012January 31, 2012 JohnNo Comments

Rails 3.1 on Heroku, TLDR Version

Create the app If not installed, install PostgreSQL rails new app_name -T -d=postgresql cd app_name/ rvm –create –rvmrc 1.9.2@app_name rvm rvmrc trust Edit .Gemfile bundle install createuser -P -S -R -d app_name (no to ‘Superuser’ and ‘Create roles’, yes to ‘Create databases’) rake db:create Create procfile in app root. foreman start and check http://0.0.0.0:5000/ Push […]

Read More…

December 13, 2011December 22, 2011 JohnNo Comments

Installing Postgresql and pgAdmin

  The default database for Heroku is PostgreSQL and, while you could use SQLite for development and Postgres for production, there are some inconsistencies between the two. Ideally you would use the same version of the database server but currently Heroku uses version 9 for dedicated databases and 8.3 for shared databases and seem to […]

Read More…

December 6, 2011December 6, 2011 John1 Comment

Setting up Rails on a Clean Install of Mac OS X Lion

I realise that OSX does not have a registry to clog up but I have just reinstalled Lion on my Macbook Air; probably a hang up from Windows. This is a checklist for installing Homebrew >> Rails. Install XCode 4.1 (There are issues with the 4.2 compiler and certain rubies and gems) Install Homebrew https://github.com/mxcl/homebrew/wiki/installation […]

Read More…

October 25, 2011December 2, 2011 John4 Comments

Rails default scripts and jquery-rails

I recently had an issue in a (3.0.7) rails app where link_to some_path, :method => :post was calling the action associated with GET, this was caused by not having a link to jquery_ujs.js (I’m using jquery so don’t want rails.js) in my html output. Googling turns up a number of suggestions to add jquery_ujs.js and […]

Read More…

June 9, 2011June 9, 2011 JohnNo Comments

Rails Autoload and Ruby Require

Rails methods of locating and loading files is mostly based on convention but is built on top of Ruby’s methods. Ruby The basic way to tell a ruby to load a file is to require it, e.g. require some_file will load some_file.rb if the file has not already been loaded. load some_file.rb will load the […]

Read More…

June 7, 2011June 7, 2011 JohnNo Comments

Launching irb from vim

You can run irb from vim with the command !irb. Running !irb -r % should run the current file in irb then leave irb open. Unfortunately ruby 1.9.2 removed the current directory from the load path which causes this to fail. You could construct a path but it is easier to add the current directory […]

Read More…

May 19, 2011December 6, 2011 JohnNo Comments

Rails, Compass, HTML5 Boilerplate and Heroku

Overview HTML5 provides some great functionality but also, potentially, some headaches. HTML5 Boilerplate is a template which aims to solve the various cross-browser differences. There is a gem to use HTML5 Boilerplate in a rails app which uses Compass to build the CSS. Using Compass on Heroku requires a small workaround as Heroku limits where […]

Read More…

April 14, 2011December 6, 2011 JohnNo Comments

Posts navigation

Older posts

Social

  • View John_Plummer’s profile on Twitter
  • View johnplummer’s profile on LinkedIn
  • View JohnPlummer’s profile on GitHub

Recent Posts

  • Javascript imports and exports
  • What is Lambda Calculus
  • VS Code as a markdown editor
  • Why Measure Dev Team Productivity?
  • Synchronising Filezilla Settings via Dropbox

Tags

.Net Ajax Bdd Clickable Link Config Control Crawlers Css Files Current Version Databases Default View Dependencies Folders Framework 4 Gems Heroku Implementation Instance Methods Interface Int Id Lt Mac Namespaces Nunit Os X Override Preference Product Controller Project Root Rake Repository Rerun Ruby Ruby and Rails Ruby On Rails Running Scripts Sql Databases Sql Server Stack Version Control Version Numbers Visual Studio Vm Wordpress

Archives

  • June 2018
  • May 2018
  • October 2015
  • September 2015
  • October 2014
  • September 2014
  • May 2014
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • October 2011
  • June 2011
  • May 2011
  • April 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • April 2010
  • January 2010
  • July 2008
  • July 2007
  • June 2007