lib/dir_model/model/files.rb in dir_model-0.4.0 vs lib/dir_model/model/files.rb in dir_model-0.5.0

- old
+ new

@@ -8,29 +8,30 @@ inherited_class_hash :files end module ClassMethods # @return [Array<Symbol>] file names for the row model - def file_names - files.keys + 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(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) - file_names.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