Is build_record a method?


#1



Is build_record a method?


def create_record(attributes, raise_error = false)
  record = build_record(attributes)
  yield(record) if block_given?
  saved = record.save
  set_new_record(record)
  raise RecordInvalid.new(record) if !saved && raise_error
  record
end


#2

The way it is written it looks like a method, but whether it is a built-in Ruby method or not, one cannot say. Do you have a link to this exercise?


#3

https://www.codecademy.com/en/courses/ruby-beginner-en-MFiQ6/1/5?curriculum_id=5059f8619189a5000201fbcb


#4

I'm digging around in the docs and so far nothing definitive. Not sure if it is part of Rails or if somebody wrote the implementation. Will call in a Rails enthusiast...


#5

build_record seems to be part of Rails' source code, although I don't recall having seen it before.