Skip to content

Instantly share code, notes, and snippets.

@dohoonk
Last active February 3, 2016 17:13
Show Gist options
  • Select an option

  • Save dohoonk/7c45fb7f3ce7486f3b2f to your computer and use it in GitHub Desktop.

Select an option

Save dohoonk/7c45fb7f3ce7486f3b2f to your computer and use it in GitHub Desktop.
codecore

bin/rails g migration add_indicies_to_questions

bin/rake db:migrate

bin/rails c

validates :title, presence: true

q.erros q.erros.class q.erros.full_messages

validates :title, presence: true, uniqueness: true

validates :title, presence: true, uniqueness: { case_sesitive: false }

ARO life cycle of objects

##initialize phase | after_initialize / before_validation validation | after_validation / before_save save | after_save / before_commit commit after_commit These are called call backs

Question.where("view_count > 10").recent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment