Last active
December 20, 2015 20:49
-
-
Save abhishek0/6192766 to your computer and use it in GitHub Desktop.
This file contains hidden or 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' | |
/home/abhishek/.rvm/gems/jruby-1.7.4/bundler/gems/mongoid-85e146637503/lib/mongoid/railties/database.rake:18:in `(root)' | |
org/jruby/RubyArray.java:1617:in `each' | |
org/jruby/RubyArray.java:1617:in `each' | |
org/jruby/RubyKernel.java:1073:in `load' | |
Tasks: TOP => db:seed | |
(See full trace by running task with --trace) |
This file contains hidden or 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
puts 'Default users' | |
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' | |
#puts(admin.methods.grep(/child/)) | |
admin.children<< franchisee |
This file contains hidden or 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 User | |
include Mongoid::Document | |
store_in collection: "users" | |
validates :first_name,:last_name,:email,:mobile, presence: true | |
validates :locality,:city, presence: true | |
belongs_to :parent, :inverse_of => :children, class_name: "User" | |
has_many :children, :inverse_of => :parent, class_name: "User" | |
field :first_name, type: String | |
field :last_name, type: String | |
field :email, type: String | |
field :mobile, type: String | |
field :locality, type: String | |
field :city, type: String | |
field :address, type: String | |
field :blood_grp, type: String | |
field :emergency_no, type: String | |
field :user_type, type: String | |
field :dob, type: Integer | |
field :username, type: String | |
field :password, type: String | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment