Skip to content

Instantly share code, notes, and snippets.

View abhishek0's full-sized avatar

Abhishek Sharma abhishek0

  • Snapstick Inc.
View GitHub Profile
class LoginController < ApplicationController
skip_before_filter :check_authentication, :only => :index
def index
@user = User.find_by_email(params[:email])
if @user && @user.authenticate(params[:password])
render 'login/index'
else
record_not_found
end
class LoginController < ApplicationController
skip_before_filter :check_authentication, :only => :index
def index
user = User.find_by_email(params[:email])
if user && user.authenticate(params[:password])
respond_with user
else
render
end
class LoginController < ApplicationController
skip_before_filter :check_authentication, :only => :index
def index
user = User.find_by_email(params[:email])
if user and user.authenticate(params[:password])
respond_with user
end
end
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)
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
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
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'
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'
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'
** 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'