First, moved JSON Parsing to a new helpers directory, which is automatically loaded before models.
Second, added new must_be_a and must_be_authenticated methods available for routes. These can be used instead of pass unless @item["type"] == clauses for more readable pre-conditions. An example:
post '/phases/:title/:slug' do
must_be_a :video
must_be_authenticated
instead of
post '/phases/:title/:slug' do
pass unless @item
pass unless @item["type"] == :video
pass unless @user
First, moved JSON Parsing to a new
helpers
directory, which is automatically loaded before models.Second, added new
must_be_a
andmust_be_authenticated
methods available for routes. These can be used instead ofpass unless @item["type"] ==
clauses for more readable pre-conditions. An example:instead of