Skip to content

Methods to expose only specified attributes in ActiveRecord when using the helpers to_json and to_xml

Notifications You must be signed in to change notification settings

chrisharper/only_expose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

only_expose allows you to specify which attributes of an ActiveRecord method should be exposed when using to_json or to_xml. It makes exposing model data easier to manage.

Usage

class Foo < ActiveRecord::Base
  include OnlyExpose
  only_expose :name
end

This defines a class Foo which will only expose the attribute 'name' when to_json or to_xml is used.

Do as you please license.

About

Methods to expose only specified attributes in ActiveRecord when using the helpers to_json and to_xml

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages