Tutorial by Examples

class Post < ActiveRecord::Base belongs_to :user has_many :comments validates :user, presence: true validates :title, presence: true, length: { in: 6..40 } scope :topic, -> (topic) { joins(:topics).where(topic: topic) } before_save :update_slug after_create :send_wel...
Controller is an entry point to our application. However, it’s not the only possible entry point. I would like to have my logic accessible from: Rake tasks background jobs console tests If I throw my logic into a controller it won’t be accessible from all these places. So let’s try “skinny ...

Page 1 of 1