module TokAccess::Generators::OrmHelper
Private Instance Methods
migration_data()
click to toggle source
# File lib/generators/tok_access/orm_helper.rb, line 27 def migration_data <<-RUBY.strip_heredoc t.string :password_digest, null: false, default: "" RUBY end
migration_exists?(table_name)
click to toggle source
# File lib/generators/tok_access/orm_helper.rb, line 11 def migration_exists?(table_name) Dir.glob("#{File.join(destination_root, migration_path)}/[0-9]*_*.rb").grep(/\d+_add_tok_access_to_#{table_name}.rb$/).first end
migration_path()
click to toggle source
# File lib/generators/tok_access/orm_helper.rb, line 15 def migration_path @migration_path ||= File.join("db", "migrate") end
migration_version()
click to toggle source
# File lib/generators/tok_access/orm_helper.rb, line 23 def migration_version "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end
model_exists?()
click to toggle source
# File lib/generators/tok_access/orm_helper.rb, line 7 def model_exists? File.exist?(File.join(destination_root, model_path)) end
model_path()
click to toggle source
# File lib/generators/tok_access/orm_helper.rb, line 19 def model_path @model_path ||= File.join("app", "models", "#{file_path}.rb") end