Sha256: acaf707411534e100e451c318d45b3db5a1ba68f5ead2860511bd04bc90e70ac
Contents?: true
Size: 721 Bytes
Versions: 1
Compression:
Stored size: 721 Bytes
Contents
require 'ember/version' module Ember module Generators class ModelGenerator < ::Rails::Generators::NamedBase source_root File.expand_path("../../templates", __FILE__) argument :attributes, :type => :array, :default => [], :banner => "field[:type] field[:type] ..." desc "Creates a new Ember.js model" def create_model_files template 'model.js', File.join('app/assets/javascripts/models', class_path, "#{file_name}.js") end private def parse_attributes! self.attributes = (attributes || []).map do |attr| attr = attr.split(':') { name: attr[0], type: attr[1] } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ember-rails-0.5.0 | lib/generators/ember/model_generator.rb |