Serialize value attribute on Preference

Rails 4 doesn't type-cast unknown types to YAML so the build were
getting errors like "can't cast type array to string"
see https://github.com/rails/rails/pull/4558
Fix another use of AS::Callbacks#run_callbacks

Rails 4 implementation doesn't have a key as second argument anymore
see https://github.com/rails/rails/pull/6241
Fix conflict between product available and search scopes

Search::Base#retrieve_products would add another scope regarding
spree_prices currency to the query. While in Rails < 4 the last scope
would override the first now it just combines all of them with "AND"

see https://github.com/rails/rails/issues/7365 for lots of discussion on
the subject

I let the `currency` argument on the `available` scope for now just so
that we don't need to change too much code at this point
Add lambdas to associations and scopes

Helps to get rid of deprecation warnings

[Fixes #3126]