6

weekly learning

Posted by ilake on September 10, 2016

“strive 9/3 ~ 9/10”

Use

  • [gem] deface

    • Deface is a library that allows you to customize HTML (ERB, Haml and Slim) views in a Rails application without editing the underlying view.
  • [gem] has_scope

    • Has scope allows you to map incoming controller parameters to named scopes in your resources.

Read

Book

  • [ruby] modular Rails

    • Engines are generated with rails plugin new core –mountable
    • We need an empty Ruby on Rails application to hold our engines as gems
    • When using gems inside an engine, they need to be required when the engine is loaded
    • Some gems require special attention when we integrate them inside engines instead of regular Ruby on Rails applications
    • You can check if an engine is present by checking if the module is defined with defined?

Learn

  • migration in the engine plugin, how are we going to migrate it from the parent app?
initializer :append_migrations do |app|
  unless app.root.to_s.match(root.to_s)
    config.paths['db/migrate'].expanded.each do |p|
      app.config.paths['db/migrate'] << p
    end
  end
end