Skip to content

Commit

Permalink
Merge pull request #69 from sandstrom/patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
casperisfine committed May 19, 2023
2 parents 122c498 + 0b0c7d1 commit 1c809bc
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,27 @@ class Country < FrozenRecord::Base
end
```

You can also specify a custom backend. Backends are classes that know how to
load records from a static file. By default FrozenRecord expects an YAML file,
but this option can be changed per model:
FrozenRecord has two built-in backends, for JSON and YAML.
Backends are classes that know how to load records from a static file.

The default backend is YAML and it expects a file that looks like this:

```yaml
- id: 'se'
name: 'Sweden'
region: 'Europe'
language: 'Swedish'
population: 10420000
- id: 'de'
name: 'Germany'
region: 'Europe'
language: 'German'
population: 83200000

#
```

You can also specify a custom backend:

```ruby
class Country < FrozenRecord::Base
Expand Down Expand Up @@ -79,6 +97,7 @@ FrozenRecord aim to replicate only modern Active Record querying interface, and
Country.
where(region: 'Europe').
where.not(language: 'English').
where(population: 10_000_000..).
order(id: :desc).
limit(10).
offset(2).
Expand Down

0 comments on commit 1c809bc

Please sign in to comment.