Sha256: 67493dc5c56b979ca5309ffa20e35c60b40eb476d0215a6992c75125b61bd7b4

Contents?: true

Size: 1.56 KB

Versions: 26

Compression:

Stored size: 1.56 KB

Contents

require 'rails/generators'
require 'rails/generators/migration'
module PhocoderRails
  module Generators
        
    class ModelUpdateGenerator < Rails::Generators::NamedBase
      
      include Rails::Generators::Migration
        
      #argument :model_names, :type => :array, :default => [], :banner => "action action"
      #check_class_collision :suffix => "PhocoderRails"
 
      source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
      
      def self.next_migration_number(dirname)
        if ActiveRecord::Base.timestamped_migrations
          Time.new.utc.strftime("%Y%m%d%H%M%S")
        else
          "%.3d" % (current_migration_number(dirname) + 1)
        end
      end
    
      def create_migration_file
        migration_template 'model_update_migration.rb', "db/migrate/make_#{file_name.pluralize}_encodable.rb"
        #migration_template 'model_thumbnail_migration.rb', "db/migrate/create_#{file_name.singularize}_thumbnails.rb"
      end
      
      def create_model_file
        #template 'model.rb', File.join('app/models', class_path, "#{file_name.singularize}.rb")
        template 'model_thumbnail.rb', File.join('app/models', class_path, "#{file_name.singularize}_thumbnail.rb")
      end
      
      
    protected
 
      #def create_views_for(engine)
      #  for state in model_names do
      #    @state  = state
      #    @path   = File.join('app/cells', file_name, "#{state}.html.#{engine}")
      # 
      #    template "view.#{engine}", @path
      #  end
      #end
        
        
        
        
    end
    
  end
end 
  

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
phocoder-rails-0.0.58 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.57 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.56 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.55 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.54 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.53 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.52 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.51 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.50 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.49 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.48 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.47 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.46 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.45 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.44 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.43 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.42 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.41 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.40 lib/generators/phocoder_rails/model_update_generator.rb
phocoder-rails-0.0.39 lib/generators/phocoder_rails/model_update_generator.rb