Sha256: 84d8afb33752f4ee382e05f62f8b36b398ea884a792d1e4a2a50608a67dc0705

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

= 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) 1.9.3 (p0)
* Ruby (MRI) 1.9.2 (p180)
* Ruby (MRI) 1.8.7 (p334)
* Ruby (REE) 1.8.7 (2011.03)
* JRuby 1.6.2
* Rubinius 1.2.4

== 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 %>
  
View:

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

== Status

{<img src="https://travis-ci.org/ksylvest/serializer.png" />}[https://travis-ci.org/ksylvest/serializer]
{<img src="https://codeclimate.com/badge.png"}[https://codeclimate.com/github/ksylvest/serializer]


== Copyright

Copyright (c) 2010 - 2013 Kevin Sylvestre. See LICENSE for details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
serializer-0.0.8 README.rdoc