inactive_record¶ ↑
github.com/midas/inactive_record/tree/master
DESCRIPTION:¶ ↑
InactiveRecord gives you many of the features you know and love from ActiveRecord without the need for a backing database table.
FEATURES:¶ ↑
-
An initialize method that accepts an attribute hash, including the Rails Date/Time select methods (ie. start_date(1i), etc…)
-
A to_xml method that accepts the same options as its respective ActiveRecord method
-
All validations work when you call valid?, excluding validates_uniqueness_of
-
Supports errors_for method (when validations fail, just render the new or edit form as you mormaly would)
-
Works with Rails 2.3
PROBLEMS:¶ ↑
INSTALL:¶ ↑
sudo gem install midas-inactive_record
USE:¶ ↑
Add gem requirement to your environment.rb file:
config.gem 'midas-inactive_record', :version => '1.0.0', :lib => 'inactive_record', :source => 'http://gems.github.com'
Create a model class:
class Thing < InactiveRecord::Base attr_accessor :name, :begin_date, :end_date validates_presence_of :name, :begin_date, :end_date end
In things_controller.rb:
@thing = Thing.new( params[:thing] ) unless @thing.valid? render :new return end
Now you can use errors_for, etc in your forms.
REQUIREMENTS:¶ ↑
-
ActiveRecord >= 2.2.0
LICENSE:¶ ↑
(The MIT License)
Copyright © 2009 C. Jason Harrelson (midas)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.