0.0
No commit activity in last 3 years
No release in over 3 years
Leverages the XML parsing of ActiveResource into objects without making any network calls by reading XML documents on your local filesystem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.9.8

Runtime

 Project Readme
= static_resource

== Description

A plugin that leverages the slick XML parsing into objects of ActiveResource without
making any network calls by reading XML documents on your local filesystem.
The XML documents must conform to the same ActiveResource "schema" rules in order to be
read and digested into objects.

This is great for those who don't want to store data structures that aren't necessarily
large enough to be worth storing in the database, but not small enough to "hard code"
elsewhere.

== Installation

  ruby script/plugin install git://github.com/techwhizbang/static_resource.git

== Usage

#Define an XML file somewhere within your stack, and reference it in a subclass of StaticResource
#like this:

class Country < StaticResource::Base
  self.static_resource = File.expand_path(File.dirname(__FILE__) + "/country.xml")
end

#Use the find method to read the XML file
country = Country.find(:one)

#Use the object just like you would with attributes on an ActiveResource
states = country.states
state = states.first

#Or don't subclass at all just use StaticResource::Base in the raw

static_resource = StaticResource::Base.find(:one, :from => Rails.root + "/lib/whatever.xml")

=== Other

Problems, comments, and suggestions all welcome. nick@controlaltcreate.com or visit my blog
http://techwhizbang.com