Case Study: Message Forum
Our next example uses Ruby on Rails to create a message forum website. Message forums enable users to discuss various topics. Common features of message forums include discussion groups, questions and answers and general comments. To see some popular message forums, visit messages.yahoo.com, web.eesite.com/forums and groups.google.com. In this example, users can post messages to several different forums, and administrators of the message forum site can create and delete forums.
For our message forum application, we need a table containing all of the messages. This table will be called messages and will contain attributes such as id, title, author, e-mail, created_on (the date the message was created) and forum_id (the id of the forum to which the message belongs). In addition, we need a table of all the available forums. This table, called forums, will contain attributes such as id, name, administrator and created_on (the date the forum was created).
In our message forum application, we want to have the functionality to create and delete forums, but we don’t want everyone who uses our application to be able to do this. Therefore, we will also have a users table, which contains the username/password combi-nations of all the application’s administrators.
Before we implement this design we must create the empty application called mes-sageboard and the database for this application. Type in rails Messageboard and then mysqladmin -u root create messageboard_development in the Ruby Console.
1 Logging In and Logging Out
2 Embellishing the Models
3 Generating Scaffold Code
4 Forum Controller and Forum Views
5 Message Controller and Message Views
6 Ajax-Enabled Rails Applications
Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.