advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the Code!
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 5/5 | Rate this item | 1 user has rated this item.
Email this articleEmail this article
 
Build a Wiki System with Rails
Learn how to build a simple, file-based Wiki system using the Ruby on Rails web application framework. You won't believe how easy it is. 

advertisement
he Ruby language and the Ruby on Rails (Rails for short) web application framework have created a lot of buzz in the software programming industry and for good reason. While Ruby has been around for more than a decade, the Rails framework is relatively new but it is becoming a darling of many programmers who are tired of the overly complicated world of web frameworks.


This article demonstrates just how easy it is to write a simple Wiki application using Ruby and Rails together. While Rails is used mostly to build database applications, this article goes the file-based persistence route because I personally like using Wiki systems that are file based and coincidentally they are easy to set up. In addition, very few resources on the web discuss developing non-database applications using Rails. Still, switching to a database using the Rails database support should be relatively painless if you choose to go that route.

What You Need
You'll need a working knowledge of the Ruby language and the Rails framework to follow this article. If you are new to either of these, check out the following, previously published DevX articles:

Furthermore, the Related Resources section in the left column provides some links for additional information.

In order to build and run the example wiki, you will need to have three core pieces of software installed:
  • Ruby interpreter
  • RubyGems packaging system
  • Rails framework

In addition, you will need a Ruby gem named RedCloth as the text markup engine. The following is a list of locations for all this software, along with the versions used for this article (note: this software must be installed in the order shown):

  1. Ruby interpreter (I used version 1.8.5.)
  2. RubyGems packaging system (I used version 0.9.2.)
  3. Gems:
Assuming you have everything installed, you can test your configuration using the following commands:
  1. ruby --help
  2. gem --help (or better yet, gem list --local)
  3. rails --help

Features of the Wiki System
Before jumping into the code, let's review some features that the Wiki system, I have named RailsWiki, needs to provide. Wiki systems provide simple ways of adding, editing, and removing content using the web. So, the RailsWiki naturally should enable the user to do at least the following:

  • Create a new Wiki document.
  • Edit an existing Wiki document, with the ability to use a text markup language for formatting the content.
  • View (open) an existing Wiki document.
  • Print an existing Wiki document.
  • Delete an existing Wiki document.
  • List all previously created Wiki documents (for viewing or deleting purposes).

Next, let's review UI mockups that implement these high-level feature requests, also known as user stories. Figure 1, Figure 2, Figure 3, and Figure 4 show screenshots for a wiki's home page, view feature, edit feature, and print feature, respectively. These figures reflect most of the features you need to implement RailsWiki.


Figure 1. Wiki Home Page
 
Figure 2. View Wiki


Figure 3. Edit Wiki
 
Figure 4. Print Wiki

  Next Page: The System Design


Page 1: IntroductionPage 4: Integrating the Model, View, and Controller Code
Page 2: The System DesignPage 5: Other Notable Files
Page 3: Developing the "Model" Class 
Please rate this item (5=best)
 1  2  3  4  5
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
  PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
HP eBook: Guide to Storage Networking
MORE WHITEPAPERS, EBOOKS, AND ARTICLES