Sha256: d4da3fa3aa975ec85a2acb1e0f43927edac7ca0e6b4245fdf404b490cb2641e2
Contents?: true
Size: 969 Bytes
Versions: 2
Compression:
Stored size: 969 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={}) files_object.merge(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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dir_model-0.7.1 | lib/dir_model/model/files.rb |
dir_model-0.7.0 | lib/dir_model/model/files.rb |