Class: Rails::Generators::ChannelGenerator

Inherits:
NamedBase
  • Object
show all
Defined in:
lib/rails/generators/channel/channel_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_channel_fileObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rails/generators/channel/channel_generator.rb', line 14

def create_channel_file
  template "channel.rb", File.join("app/channels", class_path, "#{file_name}_channel.rb")

  if options[:assets]
    if behavior == :invoke
      template "assets/cable.js", "app/assets/javascripts/cable.js"
    end

    js_template "assets/channel", File.join("app/assets/javascripts/channels", class_path, "#{file_name}")
  end

  generate_application_cable_files
end