LESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/typography.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/template.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/responsive.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/k2.less

Follow Me Icons

 

Follow @KendrickColeman on TwitterConnect on LinkedInWatch My Videos on YouTubeFollow me on FacebookCheck Out My Projects on GitHubStay Up To Date with RSS

Search

BSA 728x90 Center Banner

Using Rails, Aptana, PostgreSQL, and Heroku Seamlessly

I'm beginning my world diving into ruby and rails development. I'm 2 days into it and I'm liking it so far. I'm finally understanding what people are talking about when it comes to github, forking, heroku, and more. So why am I building this post?

 

Well I had some trouble getting started with Aptana, sqlite3, and heroku. When you start pushing packages into heroku, it doesn't like sqlite3. Sqlite3 is what is used out of the box when creating a standard Rails project and works well for what it does. However, heroku doesn't use sqlite3 and will fail on every upload because your app isn't using PostgreSQL. PostgreSQL is a much more resilient database with more features that should be used over sqlite3 on any "production" application.  So the first goal was to make any new Ruby on Rails project use PostgreSQL using Aptana. The second goal, was to make sure I had PostgreSQL setup correctly. Of course, step 2 needs to be done before step 1.

 

If you follow this guide, it will save you the few hours of time it took me to get this working correctly. I'm using a mac so take that for what it is. Railscasts #342 Migrating to PostgreSQL was a great starting point for me and deserves a majority of the thanks.

 

 

 

Lets get PostgreSQL up and running under the libraries needed.

 

Before we install homebrew or postgres, we need to change the order of which pieces are searched for on your machine because you will get a warning message that "warning /usr/bin occurs before /usr/local/bin" to make sure this does happen open your /etc/paths file, put /usr/local/bin on top of /usr/bin at the terminal. you may want to reboot now. i did.

{codecitation}

$ sudo vi /etc/paths


/usr/local/bin
/usr/local/sbin
/usr/bin
/bin
/usr/sbin
/sbin

{/codecitation}

 

Now lets install homebrew at the terminal

{codecitation}

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

{/codecitation}

 

Homebrew is installed, lets start install PostgreSQL

{codecitation}

brew install postgresql

{/codecitation}

 

It will take a few minutes for all the packages to be downloaded. Once they are all downloaded the installation begins, but we need to create the database, run the following command

{codecitation}

initdb /usr/local/var/postgres

{/codecitation}

 

I prefer to start and stop the server manually. (BTW, i used the Postgres.app but it didn't work correctly for my purposes. Aptana looks in a certain directory during use). Let's start the server. You will want to burn this line in memory so you can remember to restart the server when you want to work on your apps some more.

{codecitation}

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

 

to stop

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log stop

{/codecitation}

 

now if we run a few commands we can see what version of postgres is running and where it's running

{codecitation}

$ psql --version
psql (PostgreSQL) 9.2.4
$ which psql
/usr/local/bin/psql

{/codecitation}

 

OK, at this point we have PostgreSQL working. To make sure our postgres gem works properly we need to uninstall and re-install the gem.

{codecitation}

gem uninstall pg

gem install pg

{/codecitation}

 

Now, the bad part is that you cannot specify PostgreSQL as your database when creating a new Rails Project in Aptana. So we have to rely on the terminal command line to create it the way we want. go to your Aptana working directory in the terminal and type the command

{codecitation}

rails new my-new-rails-project -d postgresql

{/codecitation}

 

From here you can initialize git via CLI, but i prefer to run everything through Aptana because it will create the .gitignore file for us.

 

Open up Aptana, click File -> New Rails Project and type your name as the SAME exact name that was done in the CLI. If you type the name correctly, you will see a warning come up saying that it has detected a rails application. This is a good thing. Click Finish.

 

 

You will see your project in Aptana so lets now initialize it for git. Right click on your browser pane and click on Initialize Git repository. Now all your files will have *'s next to them saying they are changed files that need to be committed for initial commit.

 

Lets change the database parameters real quick. Edit the database.yml file and change the username to your computer's username. in my case (since it is a company laptop its colemk1). Save the database.yml file by doing Command+S

 

Lets create the database by going to the terminal and going to our project folder and running the following command

{codecitation}

rake db:create:all

{/codecitation}

If you don't get any errors, then that means you are creating databases and everything is communicating. hooray!

 

Once that is done, lets open up our GitHub app. Click on File -> Add Local Repository

 

Select your project folder and click Add

 

Now you have all your files there ready for the initial commit. Go ahead and commit the changes so we can go forward with heroku.

 

Back in Aptana, click on the 'box' and hit Run Web Deployment Wizard

 

Select heroku and click next

 

add your credentials click Submit

 

click Finish

 

Now in the terminal it will probably error out asking for credentials.. no idea why. but re-add your credentials and click enter.

 

Watch it go and finish without issue and you can access your application on heroku and perform all your development on PostgreSQL without having to do the constant switching between databases.

 

 

enjoy!!

 

 

 

Related Items

LESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/styles/blue.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/styles/green.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/styles/orange.lessLESS ERROR : load error: failed to find /home4/kacole2/public_html/templates/tx_zenith/less/styles/purple.less