Sha256: f2bf0b32d915b4c591f5cda007eb8d5c99cb20ade3351ab94daa26e8876a1a95
Contents?: true
Size: 963 Bytes
Versions: 6
Compression:
Stored size: 963 Bytes
Contents
module DirModel module Model module Files extend ActiveSupport::Concern included do include InheritedClassVar inherited_class_hash :files end module ClassMethods # @return [Array<Symbol>] file names for the row model def file_name files.keys.first end # @param [Symbol] file_name name of file to find option # @return [Hash] options for the file_name def options files[file_name] end # @param [Symbol] file_name name of file to find index # @return [Integer] index of the file_name def index(file_name) 0 end protected def file(file_name, options={}) merge_files(file_name.to_sym => options) raise ArgumentError.new("You cannot define more of one file: but you can add relations, see README") if files.keys.size > 1 end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems