Fully embrace Ruby 1.9 hash syntax
Didn't bother with files in db/, config/, or features/
This commit is contained in:
parent
1413c23c50
commit
7754189187
257 changed files with 1449 additions and 1449 deletions
|
@ -2,29 +2,29 @@ class Snippet < ActiveRecord::Base
|
|||
include Linguist::BlobHelper
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :author, :class_name => "User"
|
||||
has_many :notes, :as => :noteable, :dependent => :destroy
|
||||
belongs_to :author, class_name: "User"
|
||||
has_many :notes, as: :noteable, dependent: :destroy
|
||||
|
||||
delegate :name,
|
||||
:email,
|
||||
:to => :author,
|
||||
:prefix => true
|
||||
to: :author,
|
||||
prefix: true
|
||||
attr_protected :author, :author_id, :project, :project_id
|
||||
|
||||
validates_presence_of :project_id
|
||||
validates_presence_of :author_id
|
||||
|
||||
validates :title,
|
||||
:presence => true,
|
||||
:length => { :within => 0..255 }
|
||||
presence: true,
|
||||
length: { within: 0..255 }
|
||||
|
||||
validates :file_name,
|
||||
:presence => true,
|
||||
:length => { :within => 0..255 }
|
||||
presence: true,
|
||||
length: { within: 0..255 }
|
||||
|
||||
validates :content,
|
||||
:presence => true,
|
||||
:length => { :within => 0..10000 }
|
||||
presence: true,
|
||||
length: { within: 0..10000 }
|
||||
|
||||
scope :fresh, order("created_at DESC")
|
||||
scope :non_expired, where(["expires_at IS NULL OR expires_at > ?", Time.current])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue