Permalink
Browse files

Add ArrayController option to controller generator

  • Loading branch information...
1 parent 2a9a685 commit 3970791d28c7e56e840c6e5c22c22d2844f15215 tomhuda committed Apr 13, 2012
Showing with 2 additions and 1 deletion.
  1. +1 −0 lib/generators/ember/controller_generator.rb
  2. +1 −1 lib/generators/templates/controller.js
@@ -6,6 +6,7 @@ class ControllerGenerator < ::Rails::Generators::NamedBase
source_root File.expand_path("../../templates", __FILE__)
desc "Creates a new Ember.js controller"
+ class_option :array, :type => :boolean, :default => false, :desc => "Create an Ember.ArrayController to represent multiple objects"
def create_controller_files
template 'controller.js', File.join('app/assets/javascripts/ember/controllers', class_path, "#{file_name}_controller.js")
@@ -1,4 +1,4 @@
-<%= application_name.camelize %>.<%= class_name %>Controller = Ember.Object.extend({
+<%= application_name.camelize %>.<%= class_name %>Controller = Ember.<%= options.array? ? "ArrayController" : "Object" %>.extend({
// Implement your controller here.
});

0 comments on commit 3970791

Please sign in to comment.