From 3a9658df23d6702a985457b753ff8c2470c9085f Mon Sep 17 00:00:00 2001 From: magnolia-fan Date: Sat, 9 Apr 2011 17:20:36 +0400 Subject: [PATCH] Users & invites models --- rails/app/controllers/track_controller.rb | 6 ------ rails/app/models/invite.rb | 9 +++++++++ rails/app/models/user.rb | 12 ++++++++++++ rails/config/mongoid.yml | 3 ++- rails/test/fixtures/users.yml | 19 +++++++++++++++++++ rails/test/unit/user_test.rb | 8 ++++++++ 6 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 rails/app/models/invite.rb create mode 100644 rails/app/models/user.rb create mode 100644 rails/test/fixtures/users.yml create mode 100644 rails/test/unit/user_test.rb diff --git a/rails/app/controllers/track_controller.rb b/rails/app/controllers/track_controller.rb index 3a418e5..dd48272 100644 --- a/rails/app/controllers/track_controller.rb +++ b/rails/app/controllers/track_controller.rb @@ -2,12 +2,6 @@ class TrackController < ApplicationController require 'net/http' require 'uri' def listen - render :json => YAML.load_file("#{RAILS_ROOT}/config/vk_accounts.yml") - end - - private - - def fetchSearch q end end diff --git a/rails/app/models/invite.rb b/rails/app/models/invite.rb new file mode 100644 index 0000000..d1c6c03 --- /dev/null +++ b/rails/app/models/invite.rb @@ -0,0 +1,9 @@ +class Invite + include Mongoid::Document + store_in :invites + + key :referer, Integer, + key :email, String, + key :code, String, + key :senton, Datetime +end \ No newline at end of file diff --git a/rails/app/models/user.rb b/rails/app/models/user.rb new file mode 100644 index 0000000..3af8e3d --- /dev/null +++ b/rails/app/models/user.rb @@ -0,0 +1,12 @@ +class User + include Mongoid::Document + store_in :users + + key :name, String, + key :password, String, + key :email, String, + key :regdate, Datetime, + key :invites, Integer, + key :referer, Integer, + key :active, Integer +end \ No newline at end of file diff --git a/rails/config/mongoid.yml b/rails/config/mongoid.yml index dacc7b5..a27eea9 100644 --- a/rails/config/mongoid.yml +++ b/rails/config/mongoid.yml @@ -1,5 +1,6 @@ defaults: &defaults - host: localhost + host: 192.168.0.100 + port: 27017 # slaves: # - host: slave1.local # port: 27018 diff --git a/rails/test/fixtures/users.yml b/rails/test/fixtures/users.yml new file mode 100644 index 0000000..63cbbdf --- /dev/null +++ b/rails/test/fixtures/users.yml @@ -0,0 +1,19 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + name: + password: + email: + regdate: + invites: + referer: + active: 1 + +two: + name: + password: + email: + regdate: + invites: + referer: + active: 1 diff --git a/rails/test/unit/user_test.rb b/rails/test/unit/user_test.rb new file mode 100644 index 0000000..a64d2d3 --- /dev/null +++ b/rails/test/unit/user_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end