This file contains 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
curl http://localhost:3000/users -d "{'user': {'firstName': 'Abhishek', 'loginInfo':{'password':'p'}}}" |
This file contains 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 ApplicationController < ActionController::Base | |
before_action :require_login | |
private | |
def check_user | |
if not request.headers["user_id"].empty? | |
def self.get_user | |
Users.get({id => request.headers["user_id"]}) | |
end |
This file contains 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
admin = User.create! :first_name => 'admin', :last_name => 'admin', :email => '[email protected]', :mobile => '9999911111', :locality => 'Goregaon', :city => 'Mumbai', :user_type => 'admin', :username => '[email protected]', :password => 'admin' | |
franchisee = User.create! :first_name => 'franchisee', :last_name => 'franchisee', :email => '[email protected]', :mobile => '9999911111', :locality => 'Goregaon', :city => 'Mumbai', :user_type => 'franchisee', :username => '[email protected]', :password => 'franchisee' | |
franchisee.parent = admin | |
franchisee.save! |
This file contains 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
** Invoke db:seed (first_time) | |
** Invoke environment (first_time) | |
** Execute environment | |
** Execute db:seed | |
Default users | |
rake aborted! | |
undefined method `push' for nil:NilClass | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/relations/bindings/referenced/in.rb:29:in `bind_one' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/relations/binding.rb:38:in `binding' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/threaded/lifecycle.rb:55:in `_binding' |
This file contains 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
Default users | |
rake aborted! | |
undefined method `<<' for nil:NilClass | |
/home/abhishek/mine/code/infocus/backend-ror/db/seeds.rb:10:in `(root)' | |
org/jruby/RubyKernel.java:1073:in `load' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:1:in `(root)' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load' | |
org/jruby/RubyProc.java:255:in `call' |
This file contains 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
Default users | |
rake aborted! | |
undefined method `<<' for nil:NilClass | |
/home/abhishek/mine/code/infocus/backend-ror/db/seeds.rb:10:in `(root)' | |
org/jruby/RubyKernel.java:1073:in `load' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:1:in `(root)' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load' | |
org/jruby/RubyProc.java:255:in `call' |
This file contains 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
Default users | |
rake aborted! | |
undefined method `push' for nil:NilClass | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/relations/bindings/referenced/in.rb:29:in `bind_one' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/relations/binding.rb:38:in `binding' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/threaded/lifecycle.rb:55:in `_binding' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/relations/binding.rb:37:in `binding' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/relations/bindings/referenced/in.rb:22:in `bind_one' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/relations/proxy.rb:25:in `bind_one' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/relations/referenced/in.rb:25:in `initialize' |
This file contains 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 CreateUsers < ActiveRecord::Migration | |
def change | |
create_table :users, id: false do |t| | |
t.primary_key :id, :uuid, :default => 'uuid_generate_v1()' | |
t.string :first_name | |
t.string :last_name | |
t.string :email | |
t.string :mobile_number | |
t.string :locality | |
t.string :city |
This file contains 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 CreateUsers < ActiveRecord::Migration | |
def change | |
enable_extension 'uuid-ossp' | |
create_table :users, id: false do |t| | |
t.primary_key :id, :uuid, :default => 'uuid_generate_v1()' | |
t.string :first_name | |
t.string :last_name | |
t.string :email | |
t.string :mobile_number | |
t.string :locality |
This file contains 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 LoginController < ApplicationController | |
skip_before_filter :check_authentication, :only => :index | |
def index | |
respond_with User.where(login_params) | |
end | |
private | |
def login_params | |
params.permit(:email, :password) |
OlderNewer