Skip to content

Commit

Permalink
adding messages resource
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jul 22, 2012
1 parent 6c18e2b commit 15ef5bd
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 54 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/messages.js.coffee
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/messages.css.scss
@@ -0,0 +1,3 @@
// Place all the styles related to the messages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
2 changes: 2 additions & 0 deletions app/controllers/messages_controller.rb
@@ -0,0 +1,2 @@
class MessagesController < ApplicationController
end
2 changes: 2 additions & 0 deletions app/helpers/messages_helper.rb
@@ -0,0 +1,2 @@
module MessagesHelper
end
3 changes: 3 additions & 0 deletions app/models/message.rb
@@ -0,0 +1,3 @@
class Message < ActiveRecord::Base
attr_accessible :value
end
55 changes: 2 additions & 53 deletions config/routes.rb
@@ -1,55 +1,4 @@
Chatty::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.

# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root to: 'welcome#index'

# Sample of regular route:
# get 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action

# Sample of named route:
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# This route can be invoked with purchase_url(id: product.id)

# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products

# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end

# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end

# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end

# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end


# See how all your routes lay out with "rake routes"
resources :messages
root to: 'messages#index'
end
9 changes: 9 additions & 0 deletions db/migrate/20120722024145_create_messages.rb
@@ -0,0 +1,9 @@
class CreateMessages < ActiveRecord::Migration
def change
create_table :messages do |t|
t.string :value

t.timestamps
end
end
end
8 changes: 7 additions & 1 deletion db/schema.rb
Expand Up @@ -11,6 +11,12 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(:version => 0) do
ActiveRecord::Schema.define(:version => 20120722024145) do

create_table "messages", :force => true do |t|
t.string "value"
t.datetime "created_at"
t.datetime "updated_at"
end

end
7 changes: 7 additions & 0 deletions test/fixtures/messages.yml
@@ -0,0 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html

one:
value: MyString

two:
value: MyString
7 changes: 7 additions & 0 deletions test/functional/messages_controller_test.rb
@@ -0,0 +1,7 @@
require 'test_helper'

class MessagesControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
4 changes: 4 additions & 0 deletions test/unit/helpers/messages_helper_test.rb
@@ -0,0 +1,4 @@
require 'test_helper'

class MessagesHelperTest < ActionView::TestCase
end
7 changes: 7 additions & 0 deletions test/unit/message_test.rb
@@ -0,0 +1,7 @@
require 'test_helper'

class MessageTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit 15ef5bd

Please sign in to comment.