Rails 4: Save Checkbox Results to Serialized Array
问题 I have a Campaign model with a channel column. This channel will store a serialized array of chosen results via checkboxes. Here's the model.. app/models/campaign.rb class Campaign < ActiveRecord::Base serialize :channels, Array end app/controllers/compaigns_controller.rb class CampaignsController < ApplicationController def index @campaigns = Campaign.all.order("created_at DESC") end def new @campaign = Campaign.new end def create @campaign = Campaign.new(campaign_params) if @campaign.save