- Intro to Fast Rails Development
- Rails Quick Start
- Rails Scaffold
- Scaffold Tour I - Resources
- Scaffold II - Forms
- User Post Relationship
- Validations & Filters
- Correct User
- Adjusting the Pages
- Header Adjustments
- Simple Twist
- 1000 Words
- Live Site on Heroku
Build a quick blog platform with Rails. (Beta tutorial.)
Now that your app can check for valid words, you just need to get a list of valid words. There are various lists online of the 1000 most common words, but you'll also want to accept alternate forms of each word. Luckily, we have a list prepared a list for you:
Download that list to your app/db folder. Then add the following code to db/seeds.rb
words = File.read('db/all_words.txt') #1 words.split.each do |word| #2 Word.create(word: word) #3 end
This code does the following:
- Reads the file to a Ruby string.
- Splits the file by its spaces and goes through each word.
- Creates a Word record for each word in the file.
rake db:seed to setup your database. Your blogging platform is now ready for action!