Class: Rails::Generators::ChannelGenerator
- Defined in:
- actioncable/lib/rails/generators/channel/channel_generator.rb
Instance Method Summary collapse
Methods inherited from NamedBase
Methods inherited from Base
base_root, class_option, default_source_root, desc, exit_on_failure?, hide!, hook_for, inherited, namespace, remove_hook_for, source_root
Methods included from Actions
#add_source, #environment, #gem, #gem_group, #generate, #git, #github, #initialize, #initializer, #lib, #rails_command, #rake, #rakefile, #readme, #route, #vendor
Constructor Details
This class inherits a constructor from Rails::Generators::NamedBase
Instance Method Details
#create_channel_file ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'actioncable/lib/rails/generators/channel/channel_generator.rb', line 16 def create_channel_file template "channel.rb", File.join("app/channels", class_path, "#{file_name}_channel.rb") if [:assets] if behavior == :invoke template "javascript/index.js", "app/javascript/channels/index.js" template "javascript/consumer.js", "app/javascript/channels/consumer.js" end js_template "javascript/channel", File.join("app/javascript/channels", class_path, "#{file_name}_channel") end generate_application_cable_files end |