This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= form_for(@conversation) do |f| %> | |
| <% if @conversation.errors.any? %> | |
| <div id="error_explanation"> | |
| <h2><%= pluralize(@conversation.errors.count, "error") %> prohibited this conversation from being saved:</h2> | |
| <ul> | |
| <% @conversation.errors.full_messages.each do |msg| %> | |
| <li><%= msg %></li> | |
| <% end %> | |
| </ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CreateBoards < ActiveRecord::Migration | |
| def self.up | |
| create_table :boards do |t| | |
| t.integer :id | |
| t.string :title, :limit => 50 | |
| t.timestamps | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Board < ActiveRecord::Base | |
| has_many :conversations | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LoginApp::Application.routes.draw do | |
| resources :boards do | |
| resources :conversations | |
| end | |
| root :to => "boards#index" | |
| resources :users, :user_sessions | |
| match 'login' => 'user_sessions#new', :as => :login |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Rails Message Boards</title> | |
| <%= stylesheet_link_tag :all %> | |
| <%= javascript_include_tag :defaults %> | |
| <%= csrf_meta_tag %> | |
| </head> | |
| <body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Layout Styles */ | |
| #wrapper { | |
| width: 750px; | |
| margin: 25px auto; | |
| border: 1px solid black; | |
| } | |
| #top_nav { | |
| padding: 5px; | |
| text-align: right; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1 id="page_title">Message Boards</h1> | |
| <p id="notice"><%= notice %></p> | |
| <table> | |
| <tr> | |
| <th align="left">Title</th> | |
| </tr> | |
| <% @boards.each do |board| %> | |
| <tr> | |
| <td><%= link_to board.title, board %></td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1 id="page_title"><%= @board.title %></h1> | |
| <p id="notice"><%= notice %></p> | |
| <%= link_to 'Rails Boards', boards_path %> > <%= link_to @board.title, @board %> <br /> | |
| <%= link_to 'Post New Message', new_board_conversation_url(@board) %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ConversationsController < ApplicationController | |
| before_filter :load_board | |
| # GET /conversations | |
| # GET /conversations.xml | |
| def index | |
| @conversations = Conversation.all | |
| respond_to do |format| | |
| format.html # index.html.erb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1 id="page_title"><%= @board.title %></h1> | |
| <p id="notice"><%= notice %></p> | |
| <%= link_to 'Rails Boards', boards_path %> > <%= link_to @board.title, @board %> <br /> | |
| <table> | |
| <tr> | |
| <th>Post / Author</th> | |
| <th>Last Reply</th> | |
| <th>Number of Replies</th> | |
| </tr> |