Showing posts with label databases. Show all posts
Showing posts with label databases. Show all posts

Sunday, July 24, 2011

More Heroku Rails Deployment Issues

I've (partially) fixed my issues with deploying to Heroku. The solution was to specify rake version 0.8.7, as noted all over Stack Overflow for people who had the same error I was getting. I could have fixed this issue earlier, if I'd realized you deploy to Heroku from Git, not from your local machine. So I was updating my code, then trying to migrate the database on Heroku and I kept getting the same error because the code hadn't been changed on Git. Still, progress!

But I'm still having a problem. Take a look at the deployed version of my Depot application:


And here's a screenshot of how it looks on my machine:


Heroku is not displaying the product listing and I can't figure out why. The database information is stored in a seed file, so I thought a heroku rake db:seed command would populate the data and fix my issue, but no such luck. I've also noticed that the new action for my Product model throws an error on Heroku, but it works on my local version. Any ideas what's going on here?

Here's a link to my git repository for this application:

Wednesday, March 16, 2011

MySQL is dead to me

All right, I'm done with MySQL for now. I've fallen into a trap with trying to get MySQL to work. I've been so focused on following the instructions in Beginning Ruby that I let my difficulty in installing MySQL completely derail my progress, rather than moving around it and looking for another solution. But no more!

I took my friend Eli's advice and switched to using sqlite. I'm also giving Beginning Ruby a break and checking out the guides on rubyonrails.org instead.

The first exercise is also building a blog, but the tutorial is designed around sqlite, so it'll be easier for me to understand than the one in Beginning Ruby, which references MySQl heavily. I'm not feeling comfortable enough to set up a database without explicit instructions yet. One day!

In the meantime, full speed ahead. I need to quit being so myopic and remember that it's about learning Ruby and getting more comfortable with it, not following a specific set of instructions.

Monday, March 14, 2011

All aboard! TOOT TOOOOOOOT

Uh oh, who just cracked open Rails and created all the necessary files and folders to begin developing his very first Ruby on Rails project? Me! I did. (This guy)

So I know I said I was going to look into getting CGI scripts to run on my web space so I could throw Loudmouth up and let people check it out, but to be honest that sounded BORING. So I took a look at chapter 13 in Beginning Ruby (I'm almost done with this book, weird!) and it's about developing a basic Rails app.

I haven't done much with it yet. I really just read through the first few pages of the chapter, got the framework set up for the project itself and sat down to blog about it. I'll begin in earnest tomorrow evening, when I've got more time to sit down and dedicate myself.

Have I mentioned how I never thought I'd be even remotely interested in back end work? Funny how things change. I'm excited to begin working on this project. I want to understand how Ruby works on the web, how to integrate it with databases, how to collect, store and retrieve information, how to adapt to user input, EVERYTHING!

Tuesday, February 22, 2011

Working with MySQL and Ruby

Whoa, what's up SQL and MySQL?

Here's something I've recently realized about learning Ruby: I can't just learn Ruby. Ruby is going to be the thrust of what I'm learning and I'll spend the bulk of my time with it, but if my ultimate goal is to make a career change and become a full time Ruby programmer, I'll have to learn other languages as well.

This idea isn't as daunting as it might have been a month and a half ago, before I even had the seed of a desire to learn Ruby.

So here's something I've noticed about working with a bit of SQL and MySQL tonight. Computer languages share a lot of the same ideas. Sure, Ruby is more elegant than something like C++ and more modern than the Basic I learned in 9th grade, but the idea is the same. So the teeny, tiny little snippet of MySQL I wrote tonight was easier to understand than it would be if I hadn't also been working with Ruby for a month and a half or so.

I actually had to cut my database work short tonight because I couldn't get the MySQL gem to install, but I WAS able to write a program that allowed me to write to a database and retrieve information from it. Pretty cool, considering that's what I've been hot balls to learn since I cracked open Beginning Ruby.

Monday, February 21, 2011

More about Ruby, Databases and Syntax

So I was extremely lazy this weekend and only spent a couple hours working with Ruby. Awful! However, I think a little time away from actively learning caused a few things to click in my head. Imagine a pair of gears, left to their own devices after hours of meddling and tinkering, that suddenly come together and begin to move. Not smoothly, perhaps, but real motion!

It's hard to describe what clicked for me. The syntax seems to make more sense the more I work with it. While working through Beginning Ruby, I've been typing every bit of code out, then attempting to run it. It's good practice, both to get used to how Ruby is written as well as learning what will cause Ruby to throw up AND how to fix those little problems. How often do you guys do something stupid like this?

class Person
  attr_accessor :name, :age
end

fred = Preson.new
fred.name = "Fred"
fred.age = 35

puts fred.name
puts fred.age

Only to have Ruby throw up everywhere because of two little letters that got switched?

I'm guessing this transposition kind of crap is something that will haunt me FOREVER, but I'll get better at spotting it as I go along.

Also I would like to say that I wrote this bit of example code almost ENTIRELY from memory. So things are sticking. I still have a hard time believing how easy some of this is, but there's still plenty I don't really understand yet. Still, let's not get ahead of ourselves here.

Still working through Chapter 9. I just installed my_sql. How do you pronounce this, anyway? I heard a guy at the meetup a couple weeks ago call it "My Sequel" which seems better than "MY SQL" but I don't know.

Thursday, February 17, 2011

Ruby and Databases

I started digging into Chapter 9 in Beginning Ruby tonight. It's all about databases and while I never, ever thought I'd be excited about working with databases, this chapter is something I've been looking forward to for a while.

Let me tell you why.

Up until now, for all the little programs and tests I've been making, I've been inputting static variables. It's my understanding static variables have limited real-world application. I want to learn how to write code that can write, interpret and modify data and this database work is the first step to understanding that process.

So far, I've been able to get Ruby to create a new text file, write something in that file and then close it. I've learned how to open files in read or write only mode, in read AND write mode, in append mode and so on. Fascinating! But it's a bit difficult to grasp. Still, I think I've got the basics of how it works, now I just need to keep working through and figuring out what I can do with these commands.

Is there a site you can join to write and publish Ruby code for testing? Is that what Heroku is for? Anyone?

Bueller?