new

new(attributes = nil, options = {})
Class Public methods

New objects can be instantiated as either empty (pass no construction parameter) or pre-set with attributes but not yet saved (pass a hash with key names matching the associated table column names). In both instances, valid attribute keys are determined by the column names of the associated table รข hence you can't have attributes that aren't part of the table columns.

Example:

# Instantiates a single new object
User.new(first_name: 'Jamie')
doc_ruby_on_rails
2015-06-20 00:00:00
Comments
Leave a Comment

Please login to continue.