A A
RSS

Archive | Code example

How To Use Fixtures to Populate Your Database in Rails

Friday, July 11, 2008

5 Comments

This is a response to the email I’ve been getting asking me how to use fixtures to load data into a database. You want to create dummy entries in your Rails app, either for testing, for development, or for production, to make your site appear popular. Whatever the reason, populating your database can be done easily [...]SHARETHIS.addEntry({ title: "How To Use Fixtures to Populate Your Database in Rails", url: "http://biodegradablegeek.com/2008/07/how-to-use-fixtures-to-populate-your-database-in-rails/" });

How to POST Form Data Using Ruby

Thursday, April 24, 2008

0 Comments

Being able to post data on web forms from your own apps will give you the ability to write tools, services,and provide automation, by interacting with resources already available on the web. This is a very brief example on how this can be accomplished in Ruby, using Net::HTTPand this POST form example. Looking at the source [...]SHARETHIS.addEntry({ title: "How to POST Form Data Using Ruby", url: "http://biodegradablegeek.com/2008/04/how-to-post-form-data-using-ruby/" });

Introduction to Validations & Validation Error Handling in Rails

Friday, February 8, 2008

1 Comment

Validations in Ruby on Rails are essentially nothing more than methods that ensure that the data in a model is valid before saving it to the database. Traditionally, we validate data coming in using conditional expressions (for example, if email != NULL or if passwd==passwd_confirmation). This task is essential, but boring and tedious, but Rails’ [...]SHARETHIS.addEntry({ title: "Introduction to Validations & Validation Error Handling in Rails", url: "http://biodegradablegeek.com/2008/02/introduction-to-validations-validation-error-handling-in-rails/" });

Understanding Basic Database Relationships in Rails

Wednesday, December 26, 2007

9 Comments

This short tutorial will be beneficial for you if database relationships and keywords like belongs_to and has_many confuse you, or if you’re trying to find out how relationships are implemented in Rails. As we create a small demonstration project, you’ll see that one beauty of Rails is how it does most of the work gluing [...]SHARETHIS.addEntry({ title: "Understanding Basic Database Relationships in Rails", url: "http://biodegradablegeek.com/2007/12/understanding-basic-database-relationships-in-rails/" });

Using Vim as a Complete Ruby on Rails IDE

Thursday, December 13, 2007

19 Comments

NOTE: If you are experiencing segmentation faults with vim and rails.vim, see this post. When coding in Ruby on Rails, you’ll usually be switching between files and running scripts a lot. It can be time-consuming and frustrating coding Rails using a traditional text editor designed for working on big files individually. Vim lets you hop around [...]SHARETHIS.addEntry({ title: "Using Vim as a Complete Ruby on Rails IDE", url: "http://biodegradablegeek.com/2007/12/using-vim-as-a-complete-ruby-on-rails-ide/" });