This week I experienced some discouragement, but I pushed through it and refocused on my goals. I had some issues with a test I was given last week, I was unable to finish the assignment completely by the deadline, which discouraged me somewhat. The good thing is that I discovered a few areas that I needed to stop and work on before going much further. My areas of difficulty included, associations, Carrierwave and RSpec. Since the test deadline has passed, I decided to create a duplicate repository of the test project so that I can continue on and finish it for the experience. I don’t like leaving things undone, especially when there is something that I don’t quite understand.
I am very fortunate to have a friend that is working with me to complete this project. I am so grateful for our great local ruby group, everyone is passionate about what they do and always willing to help each other. I have discovered that this is true no matter where you live, the ruby/rails community in general is full of great people, some of which I have had the opportunity to meet recently via Twitter and email. It’s encouraging to know that you won’t be looked down on like a dumb n00b for asking questions. So far, everyone that I have spoken with in the community has been very eager to help and never condescending.
Ok, let’s get to some questions:
Q. Why do I have issues deploying to Heroku when using sqlite3?
A. I recently deployed my first app to Heroku, just for testing purposes. In doing so I learned that Heroku doesn’t support Sqlite3, which is what is in place by default when you generate a new rails app. In order to deploy to Heroku, you need to change the Gemfile slightly. In the Gemfile, you will see gem ‘sqlite3′ remove that and replace it with the following.
group :development do gem 'sqlite3' end group :production do gem 'pg' end
Then go back to the terminal and run “bundle install –without production” you should now be able to successfully deploy to Heroku using postgresql for production.
Q. How can I modify the database after I have set things up for my app?
A. I just learned how to do this, but I was advised that it’s not a good practice because it wipes out the database. In my case, I had just started the project and there wasn’t anything important in the database yet. The issue was that I didn’t have a user_id field in my table, so I went to the app/db/migrate folder and searched for the migration that included the table that needed to be modified. Once there, I simply added the field into the table, then back in the terminal, I ran rake db:drop which wipes out the table. Next, I ran rake db:migrate which gets everything back in order and includes the new field in the table.
Have a question? email me at email@example.com
If you found this useful, please share.