Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- require 'sequel'
- module Post
- @@DB=Sequel.sqlite
- @@DB.create_table :post do
- primary_key :id
- String :title
- Text :body
- String :tags
- String :option
- String :username
- Integer :user_id
- end
- @@post=@@DB[:post]
- def Post.add(params, user_info)
- @@post.insert(
- :body=>params[:body],
- :title=>params[:title],
- :tags=>params[:tags],
- :username=>user_info[:username],
- :user_id=>user_info[:id],
- :option=>user_info[:option]
- )
- end
- def Post.get_all(params)
- @@post.all
- end
- def Post.get_id(params)
- @@post[:id=>params[:post_id].to_i]
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement