Skip to content

Commit

Permalink
Tweaked README to reflect existence of :default option to #field.
Browse files Browse the repository at this point in the history
  • Loading branch information
mstahl committed Oct 16, 2012
1 parent b82f483 commit 2c24ae1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -18,10 +18,11 @@ Let's say that you have an ActiveRecord model called Musician, and you want to e
presents :musician
field :name
field :genre
field :instrument, :default => 'guitar'
end
end

That's actually all you have to do. The `presents` method maps your Musician presenter to a root-level class called `Musician`, and the `field` methods map to attributes *or* methods on the associated AR Musician instance.
That's actually all you have to do. The `presents` method maps your Musician presenter to a root-level class called `Musician`, and the `field` methods map to attributes *or* methods on the associated AR Musician instance. If a default is set for a field, that default value will be stored when the presenter is used to create a record, unless overridden.

What's that, you say? How is the appropriate AR Musican record associated? Simple. Invoke an instance of the `MyApi::Musician` passing in an `:id` parameter, and it just works:

Expand Down

0 comments on commit 2c24ae1

Please sign in to comment.