lib/generators/hoc_utils/api_scaffold/api_scaffold_generator.rb
# Generates the model and the migration. Overrides the model definition to add acts_as_api block
Generates the model and the migration. Overrides the model definition to add acts_as_api block
Generates the model and the migration . Overrides the model definition to add acts_as_api block
def generate_model
        say "Generates app/models/#{singular_table_name}.rb", :bold
        invoke :model
        inject_into_class "app/models/#{singular_table_name}.rb", singular_table_name.camelize do
<<-ACTS
  acts_as_api
  api_accessible :basic do |t|
  #{attributes_names.map { |name| "\tt.add :#{name}" }.join("\n")}
    t.add :created_at
    t.add :updated_at
  end
ACTS
        end
      end
def generate_model say "Generates app/models/#{singular_table_name}.rb" , :bold invoke :model inject_into_class "app/models/#{singular_table_name}.rb" , singular_table_name . camelize do <<-ACTS 

  acts_as_api
  api_accessible :basic do |t|
   #{ attributes_names . map { | name | "\tt.add :#{name}" } . join ( "\n" ) } 
    t.add :created_at
    t.add :updated_at
  end

 ACTS end end
Generates the model and the migration.
Generates the model and the migration .