Use active_model_serializer with a non-ActiveRecord object

The model object needs to include it thusly: # active_model_serializers 0.10+ class ModelName include ActiveModel::Serialization end # active_model_serializers < 0.10 class ModelName include ActiveModel::SerializerSupport end This implements the methods needed within the object, and also auto-discovers the serializer matching the object name, so it can be used transparently just like an ActiveRecord object. This works … Read more

Using turbolinks in a Rails link_to

Edit for Rails 5+: @ManishShrivastava correctly pointed out the different syntax needed for Rails 5 as shown in Joseph’s answer. <%= link_to(‘Giraffe’, @giraffe, data: { turbolinks: false }) %> For Rails 4 and below Originally I thought you needed to use the hash rocket syntax for the symbol but that isn’t the case. You can … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)