Project

serializer

0.01
No commit activity in last 3 years
No release in over 3 years
Serializer is a Ruby on Rails tool for adding accessor to serialized attributes with support for types and defaults.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

> 3.0.0
 Project Readme

Serializer¶ ↑

Serializer is a Ruby on Rails tool for adding accessor to serialized attributes with support for types and defaults.

Requirements¶ ↑

The gem is tested with:

  • Ruby (MRI) 2.0.0

  • Ruby (MRI) 1.9.3

  • JRuby 1.7.6

  • Rubinius 2.1.1

Installation¶ ↑

gem install serializer

Examples¶ ↑

Migration:

rails g model user name:string email:string settings:text

Model:

class User < ActiveRecord::Base

  has_serialized :settings do |settings|
    settings.define :tw_share, type: :boolean, default: true
    settings.define :fb_share, type: :boolean, default: true
    settings.define :completion, type: :float, default: 50.0
  end

end

Form:

<%= form_for @user do |form| %>
  <%= form.text_field :name %>
  <%= form.email_field :email %>
  <%= form.checkbox_box :tw_share %>
  <%= form.checkbox_box :fb_share %>
<% end %>

iew:

<%- if @user.tw_share? -%>
  ...
<%- end -%>
 <%- if @user.fb_share? -%>
  ...
<%- end -%>

Status¶ ↑

<img src=“https://travis-ci.org/ksylvest/serializer.png” /> <img src=“https://codeclimate.com/badge.png”

Copyright © 2010 - 2013 Kevin Sylvestre. See LICENSE for details.