Giter VIP home page Giter VIP logo

skills-database's Introduction

== Welcome to the Skills Database

Instructions about the project here...

== Getting Started

After cloning or performing a pull, run "bundle install" to ensure you have the latest gems listed in the Gemfile used in the project.  This should download and install the gems listed from the "source" gem repository listed at the top.

I've added two models for initial rails3/couchdb testing: Contact and Address (maybe a rename later).  Once you've updated, run the command "rails console" to load up the development environment in an irb console.  This will allow you to play around with your models in a scripting type environment.  Type "exit" to quit the irb console.  Test out the couchdb functionality using the following irb commands:

Make sure you start CouchDBX and have a database created and named "skillsdatabase".  This is defined in the Contact.rb model file.  This should eventually be refactored into a base model class.

--------------------- within irb console
puts "You have #{Contact.all.size} contacts"
# => You have 0 contacts

todd = Contact.new(:first_name => 'Todd', :last_name => 'Matthews')

# just showing you can edit the instance after creating it
todd.company_name = 'Razorfish'

# assigning a new address to our contact
todd.address = Address.new(:line_1 => '730 Peachtree St.', :city => 'Atlanta', :state => 'GA')

# We could have also assign each value separately like that:
todd.address.zip_code = 30308

puts "new contact to add: #{todd.inspect}"
# => new contact to add: {"updated_at"=>nil, "company_name"=>"m|a agile", "first_name"=>"Todd", "couchrest-type"=>"Contact", "address"=>{"city"=>"Atlanta", "zip_code"=>30308, "line_1"=>"730 Peachtree St.", "state"=>"GA"}, "last_name"=>"Matthews", "created_at"=>nil}

# let's save this contact into couchdb
todd.save

puts "You now have #{Contact.all.size} contact(s)"
# => You now have 1 contact(s)

# let's reload the objects from the database
todd_from_db = Contact.first

puts todd_from_db.inspect
# => {"updated_at"=>Sat Oct 30 1:52:01 -0700 2010, "company_name"=>"Razorfish", "_id"=>"749a89203d5cb217d18295d416f9fb2b", "_rev"=>"1-2705668756", "first_name"=>"Todd", "couchrest-type"=>"Contact", "address"=>{"city"=>"Atlanta, "zip_code"=>30308, "line_1"=>"730 Peachtree St.", "state"=>"GA"}, "last_name"=>"Matthews", "created_at"=>Sat Oct 30 1:52:01 -0700 2010}

# let's just output the address to see if it works as expected
puts todd_from_db.address
# => 730 Peachtree St.
# => Atlanta, GA 30308

# let's delete the DB since it was just a test
DB.delete!  
--------------------- End Within irb console

== Contact Information

Add developer contact information here...

skills-database's People

Contributors

boolean avatar donfuego avatar martinjacobs avatar razorfishcoder avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.