github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

artofmission / passive_record

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 16
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

PassiveRecord provides ActiveRecord-like behavior for static, non-database models. — Read more

  cancel

http://artofmission.com/passive_record/index.html

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Added new_record? method.  
artofmission (author)
Wed Jul 22 18:12:25 -0700 2009
commit  b078a0b3d616acf2a1fed36c2f00d0eee5b6c8ca
tree    9b6264d599c35bf9cb7d5b1f5ffa8a84db677b5e
parent  280fbe10314d406f9fde953eb508f8abf41ed36c
passive_record /
name age
history
message
file .gitignore Thu Oct 02 11:52:21 -0700 2008 Extracted plugin [artofmission]
file MIT-LICENSE Thu Oct 02 11:52:21 -0700 2008 Extracted plugin [artofmission]
file README.rdoc Wed Jul 22 18:12:25 -0700 2009 Added new_record? method. [artofmission]
file Rakefile Thu Oct 02 11:55:06 -0700 2008 Renamed readme [artofmission]
file init.rb Tue May 26 12:25:02 -0700 2009 Enabled subclass inheritance for PassiveRecord ... [artofmission]
directory lib/ Wed Jul 22 18:12:25 -0700 2009 Added new_record? method. [artofmission]
directory rdoc/ Wed Jul 22 18:12:25 -0700 2009 Added new_record? method. [artofmission]
README.rdoc

PassiveRecord

PassiveRecord provides ActiveRecord-like behavior for static, non-database models.

PassiveRecord was developed by Art of Mission, Inc. for Sharp Sync, a new product by Ministry Centered Technologies

Installation

Download PassiveRecord from Github: github.com/artofmission/passive_record

Install using Git Submodules:

  git submodule add http://github.com/artofmission/passive_record vendor/plugins/passive_record
  git submodule init
  git submodule update

Install with Rails’ plugin installer

  ./script/plugin install git://github.com/artofmission/passive_record.git

Example

  class Name < PassiveRecord::Base
    define_fields :first_name, :middle_name, :last_name
  end

…will create a new Name model with id, address, and location attributes.

  class Person < PassiveRecord::Base
    has_many :names
  end

  @person = Person.new(:names => [Name.new(:first_name => "Dima", :last_name => "Dozen")])

This would a Person object that has many names. You can now access the names hash just like you would an ActiveRecord object.

  @person.names #=> [#<Name:0x2031824 @last_name="Dozen", @first_name="Dima">]

You can serialize a PassiveRecord object into another database object for storage:

  class Address < PassiveRecord::Base
    define_fields :street, :city, :state, :postal_code, :country
  end

  class Company < ActiveRecord
    serialize :address
  end

  @company.address = Address.new(:street1 => "123 4th St", :city => "Wellington", :country => "NZ")

Resources for Non-ActiveRecord models

  • railscasts.com/episodes/121-non-active-record-model

Due Credit

  • Ministry Centered Technologies created the need
  • Ryan Heneise of Art of Mission, Inc. wrote the code

Contributors

  • felipemesquita (github.com/felipemesquita)

Copyright © 2008 Ryan Heneise, released under the MIT license

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server