lib/generators/effective/helpers.rb in effective_developer-0.2.4 vs lib/generators/effective/helpers.rb in effective_developer-0.2.5

- old
+ new

@@ -48,19 +48,19 @@ # Turns the GeneratedAttribute or Effective::Attribute into an array of strings def invokable(attributes) attributes.map { |att| "#{att.name}:#{att.type}" } end - def resource_attributes - klass_attributes = resource.klass_attributes + def resource_attributes(all: false) + klass_attributes = resource.klass_attributes(all: all) if klass_attributes.blank? if ActiveRecord::Migrator.new(:up, ActiveRecord::Migrator.migrations(ActiveRecord::Migrator.migrations_paths)).pending_migrations.present? migrate = ask("Unable to read the attributes of #{resource.klass || resource.name}. There are pending migrations. Run db:migrate now? [y/n]") system('bundle exec rake db:migrate') if migrate.to_s.include?('y') end - klass_attributes = resource.klass_attributes + klass_attributes = resource.klass_attributes(all: all) end klass_attributes.presence || resource.written_attributes end