2014-08-16 at

ActiveRecord Notes

2014-08-24
Rails 4.1

# `serialize` directive:
#
# http://api.rubyonrails.org/classes/ActiveRecord/Base.html
# Data is stored in text form in the DB, but turns into a hash when it
# hits Rails.

# `store` directive: apparently a super-set of `serialize`
#
# http://api.rubyonrails.org/classes/ActiveRecord/Store.html
# Extending this with OpenStruct or Struct:
# http://peternixey.com/post/27127649132/using-struct-and-serialize-to-get-flexibility-in

# Scoped queries.
#
# http://guides.rubyonrails.org/active_record_querying.html#scopes
# Even better with lambda conditions:
# http://stackoverflow.com/questions/13515225/rails-3-has-one-has-many-with-lambda-condition

# Attribute aliasing:
#
# alias_attribute :new_column_name, :real_column_name

# Virtual Attributes:
#
# ActiveRecord::Base has no setter/getter for (columns+virtual) attributes
# at once. So you can create virtual attributes, but they won't turn up
# in Record.inspect.
#
# http://stackoverflow.com/questions/7884650/why-do-attr-accessor-virtual-attributes-not-get-outputted-when-you-do-record-ins
# http://stackoverflow.com/questions/9376744/rails-add-attributes-not-in-model-and-update-model-attribute
# http://hibbard.eu/using-virtual-attributes-in-rails-3/
# http://stackoverflow.com/questions/11986792/non-persistent-activerecord-model-attributes

# Putting sub-Models in sub-directories:
#
# http://rails-bestpractices.com/posts/74-namespaced-models

# ActiveRecord::abstract_class
#
# If you don't set this to `true`, sub-Model will call the super-Model's table.
# http://api.rubyonrails.org/classes/ActiveRecord/Inheritance/ClassMethods.html

# Note on Strong Parameters
#
# http://stackoverflow.com/questions/17371334/how-is-attr-accessible-used-in-rails-4

# In general:
# http://blog.mitchcrowe.com/blog/2012/04/14/10-most-underused-activerecord-relation-methods/

# Validation:
# validates_each

# Callbacks:
# http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html

2014-08-15 at

Getting Sorted

Time to get a little sleep before Friday. Wrapped a 17 hour day. Slow and steady. Second week as an FTE computer programmer. Getting back into the groove. One square meal, several coffees and doses of protein powder. Multi-km runs a few times a week on average. Inching back into shape, cash or no cash. Hehe.