Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To enable ActiveDecorator in Sinatra, register it like:
Then ActiveDecorator::Sinatra reads
ROOT/decorators/*_decorator.rb
,and decorates instance variables in
scope
and local variables passedvia
render
method with them.The
ROOT/decorators
directory is used by default. If you want to useanother directory, you can set it as
:decorators
like:ActiveDecorator::Sinatra doesn't decorate following instance variables
by default:
These are declared in an array named as
ActiveDecorator::Sinatra::DEFAULT_PROTECTED_INSTANCE_VARIABLES
. If youwant to protect other instance variables, you can declare them as
:protected_instance_variables
like:Note that these
set
statements must be placed before theregister
statement.
Specs for Sinatra run with the fllowing command:
Sinatra doesn't support implicit object rendering (like
render @author
),so features about this won't tested in the partial spec. This switching
is made with
rails?
method decrared in spec_helper.rb.