TMXCredit/flat_map — pull request #9 by akuzko (2014-11-19 16:09:01+00:00)
Title: Fix callbacks behavior on save

## Primary change

Let's imagine a setup:

```ruby
class UserMapper < FlatMap::Mapper
trait :registration do
set_callback :save, :after, :notify_user

def notify_user
UserMailer.delay.send_registration_notification(target.id)
end
end
end

mapper = UserMapper.build(:registration)
mapper.apply(user_params)
```

At version `0.1.0`, `UserMapperRegistrationTrait`'s save routines are triggered *before* `UserMapper`'s ones. This means that target.id at this moment is `nil`, causing unpleasant errors. Such behavior is unexpected and this PR fixes that.

## Secondary change

`FlatMap::Errors#first_messages` method has been added for convenience, so we can call `render json: mapper.errors.first_messages`, for example. This may be useful in some scenarios.