Advertisement
Guest User

router (controller)

a guest
Apr 7th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.36 KB | None | 0 0
  1. # coding: utf-8
  2. require 'sequel'
  3.  
  4. class Chat
  5.     @@DB=Sequel.sqlite
  6.     @@DB.create_table :messages do
  7.         primary_key :id
  8.         String :body
  9.         String :username
  10.     end
  11.     @@messages=@@DB[:messages]
  12.     def Chat.send(params, user_info)
  13.         @@messages.insert(:body=>params[:body], :username=>user_info[:username])
  14.     end
  15.     def Chat.get(params, user_info)
  16.         @@messages.all
  17.     end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement