
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
active_record-serializable
Advanced tools
Extension for ActiveRecord to get serializable and marshalizable models using Rasti::Model
Add this line to your application's Gemfile:
gem 'active_record-serializable'
And then execute:
$ bundle
Or install it yourself as:
$ gem install active_record-serializable
class User < ActiveRecord::Base
has_one :avatar
has_many :posts
end
user = User.find 1
user.to_serializable # ActiveRecord::Serializable::USER[id: 1, ...]
user = User.find 1
user.to_serializable include: [:avatar, :posts] # ActiveRecord::Serializable::USER[id: 1, avatar: ActiveRecord::Serializable::AVATAR[...], posts: [ActiveRecord::Serializable::POST[...]]]
class User < ActiveRecord::Base
serializable_define_method :sorted_post_titles do
posts.map(&:title).sort
end
end
user = User.find 1
serializable = user.to_serializable(include: [:posts])
serializable.sorted_post_titles # ['Title 1', ...]
module Helper
def sorted_post_titles
posts.map(&:title).sort
end
end
class User < ActiveRecord::Base
serializable_include Helper
end
user = User.find 1
serializable = user.to_serializable(include: [:posts])
serializable.sorted_post_titles # ['Title 1', ...]
Bug reports and pull requests are welcome on GitHub at https://github.com/gabynaiman/active_record-serializable.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that active_record-serializable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.