Sha256: 994c97507708b6aa119a6d1bc52c0806f6fbd34b5ee5b4fc65de0f2bd7129752

Contents?: true

Size: 979 Bytes

Versions: 2

Compression:

Stored size: 979 Bytes

Contents

require 'rails/generators'

module PixelforceCms
  module Generators
    class ContactUsGenerator < Rails::Generators::Base
      source_root File.expand_path("../templates", __FILE__)

      def create_model
        copy_file "contact_us.rb", "app/models/contact_us.rb"
        copy_file "contacts_controller.rb", "app/controllers/contacts_controller.rb"
        template  "notification.rb", 'app/emailers/notification.rb'
        create_file "app/views/notification/notify_us"
        route_config = %q(
  get  '/contact', to: 'contacts#new', as: :conatct
  post '/contact', to: 'contacts#create'
        )
        inject_into_file 'config/routes.rb', "\n#{route_config}\n", { :after => '::Application.routes.draw do', :verbose => false }
      end

      def application_name
        if defined?(Rails) && Rails.application
          Rails.application.class.name.split('::').first.underscore
        else
          "application"
        end
      end
      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pixelforce_cms-0.9.9.2 lib/generators/pixelforce_cms/contact_us_generator.rb
pixelforce_cms-0.9.9.1 lib/generators/pixelforce_cms/contact_us_generator.rb