Quantcast
Channel: rails – The Agile Warrior
Browsing all 48 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

How to setup Jasmine Rails31 directory structure

Following are instructions on how to setup/configure jasmine for use with rails31. It’s mostly straight forward, just one gotcha with regards to how to tell jasmine where your source files are. 1. Add...

View Article


Image may be NSFW.
Clik here to view.

How to reference domain classes in rails

Working with active records in rails is nice because a lot of your domain is directly represented in your model classes. Sometimes however, you still need to create some domain classes that aren’t tied...

View Article


Image may be NSFW.
Clik here to view.

Rails TimeRange

Say you want to query your backend objects with a range of times. One way to do that is to define a TimeRange object which captures the time ranges you are interested in: TimeRange.rb class TimeRange...

View Article

Image may be NSFW.
Clik here to view.

A simple ruby script for reading the contents of a file and generating some...

Here’s a handy ruby script that will read the contents of a file regions.txt AB Aberdeen AL St. Albans B Birmingham BA Bath and generating some output (in this case sql) based on the content: sqlgen.rb...

View Article

Image may be NSFW.
Clik here to view.

How to add a boolean column to a table in rails

As a reminder to myself, here are some notes on how to add a boolean column to a table in rails3. Step 1: Create migration rails generate migration add_public_to_listings admin:boolean Step 2: Write...

View Article


Image may be NSFW.
Clik here to view.

How to embed HTML within a rails flash response

It doesn’t look pretty, but if you really wanted to embed a link in your rails flash response you could do it like this: flash[:success] = "Foo. #{ActionController::Base.helpers.link_to "Create new...

View Article

Image may be NSFW.
Clik here to view.

How to setup Rails3 postgres on mac

Update A much better way to install Postgres locally is to use Postgres.app. Do this and use the following commands to create your local root user (with no password) and database instance. psql...

View Article

Image may be NSFW.
Clik here to view.

How do rails environments work?

Rails environments are wonderful. But they can be a bit confusing do to some inconsistency in terms of which environments are affected when you run certain rake tasks. After some digging I think I...

View Article


Image may be NSFW.
Clik here to view.

Tips for sending email via Rails

Some reminders for how to configure email via a rails application. Watch this: http://railscasts.com/episodes/274-remember-me-reset-password Add this: production.rb config.action_mailer.delivery_method...

View Article


Image may be NSFW.
Clik here to view.

ASP.NET MVC vs Rails Routes

One thing I have always wanted to compare are the default routes you get with Rails, with the default routes you get with ASP.NET MVC. Rails ASP.NET MVC4 GET /Permits Index GET /Permits/Create Create...

View Article

Image may be NSFW.
Clik here to view.

How to read files from dir and generate html output

When creating videos, I take snapshots of keynote, upload to website, and then manually handcraft the html to include in the show notes. It’s slow, tedious, and not a lot of fun. So today I created a...

View Article

Image may be NSFW.
Clik here to view.

How to upgrade to Rails4 with Heroku

Rails migrations are never easy. But the community does it’s best to help you out. Here are some tips that helped me migrate my app: Watch this video by Ryan Bates – Upgrading to Rails4 Check out these...

View Article

Image may be NSFW.
Clik here to view.

How to add a git remote to a heroku app

There are two concepts at play here when add a user friend name hooking git up to a heroku app. There is the remote (git) and the app (heroku). git remote Git remotes are just aliases for git...

View Article


Image may be NSFW.
Clik here to view.

How to pass parameters as part of the URL in Rails

While building my latest rails app I wanted to pass the id of a video episode to my subscription service. I wanted to build a URL that looked something like this:...

View Article

Image may be NSFW.
Clik here to view.

How to add error messages top of rails page

Sometimes when I create views/controllers and models by hand I forget how rails gets error messages to appear at the top of a page. Here is a reminder for myself for when I need to add these manually...

View Article


Image may be NSFW.
Clik here to view.

Prepping models in Rails using form_for

Sometimes when building forms the rails way, you need to do some funky stuff to get your models prepped so they can be worked on in the controller. For example, here I want to create a new...

View Article

Image may be NSFW.
Clik here to view.

How to setup and amazon webservices and connect to from Rails

Some notes for future me the next time I need to do this again. Create amazon webservice account Goto management console...

View Article


Image may be NSFW.
Clik here to view.

heroku db:pull no longer working – workaround

I was disappointed when I discovered that the very handy heroku db:pull stop working for me after upgrading to Ruby 2.0 and Rails 4.0. I got it going again – by basically reverting back to Ruby 1.9.3...

View Article

Image may be NSFW.
Clik here to view.

How to install postgres rails

Download and install http://postgresapp.com/ This will automatically create a postgres user with the name of your machine (i.e. jrasmusson). Add the ‘pg’ gem to your project. gem ‘pg’ $ bundle install...

View Article

Image may be NSFW.
Clik here to view.

How to import heroku postgres locally from prod rails

Step 1: Setup Postgres locally and get working with your app. Heroku db:pull only works if you have postgres setup locally on your machine. Go here for some tips on how to do that. Step 2: Find out...

View Article
Browsing all 48 articles
Browse latest View live