sharetribe/sharetribe — pull request #558 by rap1ds (2014-09-02 07:15:01+00:00)
Title: Transaction type defaults

**Background**

There comes time when Rails will screw you big time. Things didn't work as you expected. This was it, again.

Every transaction type has a `before_validation` callback, which sets sensible defaults for the transaction type. However, this callback is NOT run if you build the model through a parent model relation and you are using STI.

```ruby
community.transaction_types.build({type: "Sell"})
```

The code above does not run the callback for Sell class.