Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

has_one_autocreate

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has_one_autocreate

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= Has One Autocreate

Automatic creation of a has_one associated object when it is first accessed.

== Examples

class User < ActiveRecord::Base has_one :profile, :autocreate => true end

class Profile < ActiveRecord::Base belongs_to :user end

make a single user

user = User.create(:name => 'Dr. User') => #<User id: 1, name: "Dr. User">

look for any profile objects

Profile.count => 0

access the user's profile object to see it automatically created

user.profile => #<Profile id: 1, title: nil, user_id: 1>

== Install

As a Rails plugin.

./script/plugin install git://github.com/jqr/has_one_autocreate.git

Prefer gems? Add this to your environment.rb and run the following command.

config.gem 'has_one_autocreate'

$ rake gems:install

== Docs

http://rdoc.info/projects/jqr/has_one_autocreate

Homepage:: http://github.com/jqr/has_one_autocreate License:: Copyright (c) 2008 Elijah Miller mailto:elijah.miller@gmail.com, released under the MIT license.

FAQs

Package last updated on 04 Dec 2009

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc