fourth!

fourth!() Instance Public methods Same as fourth but raises ActiveRecord::RecordNotFound if no record is found.

paragraph

paragraph(text) Instance Public methods

before

before(&before) Instance Public methods

clear!

clear!() Instance Public methods

options_from_collection_for_select

options_from_collection_for_select(collection, value_method, text_method, selected = nil) Instance Public methods Returns a string of option tags that have been compiled by iterating over the collection and assigning the result of a call to the value_method as the option value and the text_method as the option text. options_from_collection_for_select(@people, 'id', 'name') # => <option value="#{person.id}">#{person.name}</option> This is more often than not used ins

insert_sql

insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) Instance Public methods Also aliased as: create

from_xml

from_xml(xml) Instance Public methods Sets the model attributes from an XML string. Returns self. class Person include ActiveModel::Serializers::Xml attr_accessor :name, :age, :awesome def attributes=(hash) hash.each do |key, value| instance_variable_set("@#{key}", value) end end def attributes instance_values end end xml = { name: 'bob', age: 22, awesome:true }.to_xml person = Person.new person.from_xml(xml) # => #<Person:0x007fec5e3b3c40 @a

years_since

years_since(years) Instance Public methods Returns a new date/time the specified number of years in the future.

fifth!

fifth!() Instance Public methods Same as fifth but raises ActiveRecord::RecordNotFound if no record is found.

humanize

humanize(options = {}) Instance Public methods Capitalizes the first word, turns underscores into spaces, and strips a trailing '_id' if present. Like titleize, this is meant for creating pretty output. The capitalization of the first word can be turned off by setting the optional parameter capitalize to false. By default, this parameter is true. 'employee_salary'.humanize # => "Employee salary" 'author_id'.humanize # => "Author" 'author_id'.hu