Sha256: c151541c297207b4f682c24cb433548cab82499b0c8b1ecf7a98f212602a5e73
Contents?: true
Size: 727 Bytes
Versions: 11
Compression:
Stored size: 727 Bytes
Contents
# coding: utf-8 module Redditor class ContentBlock < ActiveRecord::Base def self.find_by_position_and_type(position, type, page_id) type.to_s.sub("s_attributes", "").camelcase.constantize.where(page_id: page_id, position: position).first end def self.init_by_type(type, params) res = type.to_s.sub("s_attributes", "").camelcase.constantize.new(params) res.valid? res end def self.check_by_position_and_type position, type, page_id type.to_s.sub("s_attributes", "").camelcase.constantize.where(page_id: page_id, position: position).any? end # def self.model_name # ActiveModel::Name.new(self, nil, self.class.name.gsub("Redditor::", '')) # end end end
Version data entries
11 entries across 11 versions & 1 rubygems