Sha256: dd51badcb6a8dbf68ee1c34f26a05a45060dabb5dca963a8fa8dd974172cb811
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
class StreamitGenerator < Rails::Generators::NamedBase source_root File.expand_path("../templates", __FILE__) class_option :migration, :type => :boolean, :default => true def invoke_model invoke "model", [name].concat(migration_columns), :timestamps => false, :test_framework => false, :migration => options.migration? end def add_model_config inject_into_class "app/models/#{file_name}.rb", class_name, <<-CONTENT include Streamit::ORM::#{Rails::Generators.options[:rails][:orm].to_s.camelize} CONTENT end def add_application_config inject_into_class "config/application.rb", "Application", <<-CONTENT # Set stream store config.streamit.set_store = lambda { ::#{class_name} } CONTENT end def create_stream_view copy_file "_stream.html.erb", "app/views/streamit/streams/_stream.html.erb" end protected def migration_columns %w(stream_type:string started_at:datetime actor_id:integer actor_type:string subject_id:integer subject_type:string receiver_id:integer receiver_type:string) end end
Version data entries
5 entries across 5 versions & 1 rubygems