Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A rails plugin for easily adding import/exportability from/to CSV

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.rdoc

IsPorterable

Importing and Exporting is a vital feature for data administration and migration. this plugin tries to make it as easy as possible to import and export data across multiple associated tables. By adding a few lines to the model, controller, routes, and a few views.

Example Usage

First execute this code `rails generate ports [MODEL]`

in model/address.rb

class Address < ActiveRecord::Base
  is_porterable
end

in controller/address_controller.rb

class AddressController < ApplicationController
  include Porterable::Controller
end

in routes

resources :address do

collection do get :ports get :import

get :export
put :scan

put :execute

  end
end

Installation

This plugin is only compatible with rails 3 at the moment. To install plugin either use gem

Install as gem

Add the “is_porterable” gem to your Gemfile.

gem "is_porterable"

Install as plugin using git

rails plugin install git@github.com:ryanong/is_porterable.git

Detailed Usage

options for is_porterable

is_porterable :unique => :name

template

Use a mapping template to associate other models

find

Rails2 style find options

exclude

Columns not to export

export function

name of function or proc to use on a row of data

include

include associated models

unique

Default: id set different primary key

Generators

rails generate ports [MODEL]

Will create the views, migration, and initial model for template

rails generate ports_template [MODEL]

Will create the model and template for the template

Copyright © 2010 Aaron Quint, released under the MIT license

Something went wrong with that request. Please try again.