https://github.com/mkon/forged_model
Ruby model enriched with some activemodel features
https://github.com/mkon/forged_model
Last synced: 12 months ago
JSON representation
Ruby model enriched with some activemodel features
- Host: GitHub
- URL: https://github.com/mkon/forged_model
- Owner: mkon
- License: mit
- Created: 2014-01-29T10:33:43.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-02-10T08:49:47.000Z (over 12 years ago)
- Last Synced: 2025-05-25T08:04:30.837Z (about 1 year ago)
- Language: Ruby
- Size: 160 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ForgedModel
Ruby model enriched with some activemodel features.
Includes `ActiveModel::Model`, `ActiveModel::Dirty` and `ActiveModel::Serialization`.
Adds a generator for instance attributes.
## Installation
Add this line to your application's Gemfile:
gem 'forged_model'
And then execute:
$ bundle
Or install it yourself as:
$ gem install forged_model
## Usage
Just subclass `ForgedModel::Model` and use the attribute generator, like so:
```ruby
Dummy < ForgedModel::Model
define_attributes :foo
end
dummy = Dummy.new(foo: "bar")
dummy.foo = "other"
dummy.foo_was # => "bar"
# ...
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request