8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/generators/wit_bot/model/model_generator.rb', line 8
def create_conversations
user_lower = user_model.underscore
migration_options = 'migration', 'CreateConversations', 'object:text', "#{user_lower}:references"
migration_options << '--force' if options[:force]
generate *migration_options
template 'model.rb.erb', 'app/models/conversation.rb'
user_file = "app/models/#{user_lower}.rb"
inject_into_class user_file, user_model, " has_one :conversation, dependent: :destroy\n"
readme 'clear_conversations.txt'
end
|