active-hash / active-hash/active_hash
support has_many in YAML sources
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.4k
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
class Plans::IsoDistro < ActiveYaml::Base
include ActiveHash::Associations
has_many :iso_images, class_name: 'Plans::IsoImage'
end
class Plans::IsoImage < ActiveHash::Base
include ActiveHash::Associations
belongs_to :iso_distro, class_name: 'Plans::IsoDistro'
end
- id: 1
code: arch
name: Arch Linux
iso_images:
- path: archlinux.iso
bit: 64
- path: ubuntu.iso
bit: 32
@isos.first
=> #<Plans::IsoDistro:0x007f75b8962348 @attributes={:id=>1, :code=>"arch", :name=>"Arch Linux", :iso_images=>[{"path"=>"archlinux.iso", "bit"=>64}, {"path"=>"ubuntu.iso", "bit"=>32}]}>
@isos.first.iso_images
=> []
This could understand nested structures and create IsoImage objects too, along with an appropriate relation.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how YAML sources are loaded and how the existing has_many and belongs_to associations resolve records; the issue provides the Plans::IsoDistro and Plans::IsoImage entry points and nested YAML example. Done means nested iso_images produce IsoImage objects and @isos.first.iso_images returns the appropriate relation, with behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100