Create a simple API with Ruby on Rails
Category: Best Articles | 784 views | 1 Comment |
Here are the few easy steps to creating a simple API in a Ruby on Rails project.
- Start a new rails app with the restful_authentication plugin by technoweenie: http://github.com/technoweenie/restful-authentication/
- The restful_authentication plugin allows for user accounts, but doesn’t have any API authentication built in. If you want to make publicly available API keys for your users, you’ll need to put this in so you can track API usage and deter any unauthorized use. So assuming you have restful_authentication all setup with defaults, follow this tutorial for setting up API authentication: http://www.compulsivoco.com/2009/05/rails-api-authentication-using-restful-authentication/
- Once you have the above api authentication applied, make sure all the actions that you want protected by the API authentication by adding a before filter:
before_filter :login_required, :only => [...array of actions to be protected...]
- To render out xml for a certain object, you can simply use a respond_to when you’re ready to render xml in the controller.
respond_to do |format|
format.xml { render :xml => @some_object }
Ruby on Rails Resources and TUTORIALS
Category: Tutorials | 2,110 views | 2 Comments |
TUTORIALS
Once you’ve installed Rails it’s time to start coding. Here are a few starting points for you.
Beginner Tutorials
After you’ve installed Rails you should be ready to start developing applications. The following links are starting places for learning the foundations of Ruby, Rails and building your first apps.
- Try Ruby! – A simple interactive tutorial teaching you the basics of Ruby in 15 minutes.
- Ruby User’s Guide – Complete step by step guide for learning Ruby.
- Learning Ruby – Uses program examples to teach you the basics of Ruby. Draws parallels between other languages to show you what makes Ruby unique.
- Hackety Hack: the Coder’s Starter Kit – An interactive program designed to teach students how to program Ruby.
- Tutorial – This tutorial walks you through building your first Rails app.
- Using Ruby on Rails for Web Development on Mac OS X – Apple’s guide for developing your first Rails application.
- Learn Ruby on Rails: the Ultimate Beginner’s Tutorial – A solid Rails tutorial with a lot of explanation rather than just mindless code.
- A Many-to-Many tutorial for Rails – A walkthrough for building your first Rails app.
- Getting Your Feet Wet With Ruby on Rails – A beginner’s guide to taking advantage of Rails’ unique design. Includes information for creating the SQL database and scaffolding.
- Beginners Guide to Rails, part 1 – Shows you how to get your Rails database off the ground.
- Really Getting Started in Rails – Brief overview of the schematics of a Rails app.
- Basedex: Ruby on Rails – A massive glossary of Ruby on Rails links.
- How-tos – An extensive how-to library containing sample programs.





