Last active
March 12, 2017 00:06
-
-
Save kdiogenes/fcb0907d87085ffaf8b8e4f26ca230e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rails/generators/rails/scaffold/scaffold_generator' | |
| module Rails::Generators | |
| class GrapesGenerator < ::Rails::Generators::ScaffoldGenerator | |
| attr_reader :fields | |
| def initialize(args, *options) #:nodoc: | |
| @fields = args[1..-1] | |
| super | |
| end | |
| hook_for :orm, as: :model do |instance, orm| | |
| instance.invoke orm, [ instance.options[:model_name], instance.fields ] | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment