Sha256: 24ee16c6d65b8ad0ca8920b6aa5a6c9bd75e852dd6519059631066baf75dfe28

Contents?: true

Size: 717 Bytes

Versions: 12

Compression:

Stored size: 717 Bytes

Contents

#coding: utf-8

class YoutubeValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    if value =~ /[^A-z0-9_-]/
      record.errors[attribute] << (options[:message] || "- используются недопустимые символы")
    end
  end
end


module Redditor
  class VideoBlock < ActiveRecord::Base
    self.table_name = "redditor_video_blocks"

    # attr_accessible :height, :page_id, :position, :width, :youtube, :temp_id
    attr_accessor :temp_id

    validates :youtube, :length => { :is => 11 }, :youtube => true

    belongs_to :page, :class_name => "Redditor::Page"

    def self.model_name
      ActiveModel::Name.new(self, nil, 'VideoBlock')
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
redditor-0.1.11 app/models/redditor/video_block.rb
redditor-0.1.10 app/models/redditor/video_block.rb
redditor-0.1.9 app/models/redditor/video_block.rb
redditor-0.1.8 app/models/redditor/video_block.rb
redditor-0.1.7 app/models/redditor/video_block.rb
redditor-0.1.6 app/models/redditor/video_block.rb
redditor-0.1.5 app/models/redditor/video_block.rb
redditor-0.1.4 app/models/redditor/video_block.rb
redditor-0.1.3 app/models/redditor/video_block.rb
redditor-0.1.2 app/models/redditor/video_block.rb
redditor-0.1.1 app/models/redditor/video_block.rb
redditor-0.1.0 app/models/redditor/video_block.rb