Sha256: 7487d55006cfc390a58faf0fe01f306a396a74f33a0c490d6789f0e4078b55cb
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
module SimpleAddressGenerator module Generators class SimpleAddressGeneratorGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) def create_address_model generate("model", "address address_line_1:string address_line_2:string city:string state:string postal_code:string country:string telephone_number:string latitude:float longitude:float category_id:integer") rake("db:migrate") remove_file "address.rb", "app/models/address.rb" end def generate_everything_else directory "gmaps4rails", "app/assets/javascripts/gmaps4rails/" directory "addresses", "app/views/addresses/" directory "stylesheets", "app/assets/stylesheets/" copy_file "addresses_controller.rb", "app/controllers/addresses_controller.rb" copy_file "address.rb", "app/models/address.rb" copy_file "icon-1.png", "app/assets/images/icon-1.png" end def insert_code_application inject_into_file "app/views/layouts/application.html.erb", after: "<%= yield %>" do a = "\n\n <%= yield :scripts %>" a end end def insert_routes route("resources :addresses") end def add_gems gem("geocoder") gem("gmaps4rails") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simple-address-generator-0.1.0 | lib/rails/generators/simple_address_generator/simple_address_generator_generator.rb |