Class: Sessions::Generators::ViewsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Sessions::Generators::ViewsGenerator
- Defined in:
- lib/generators/sessions/views_generator.rb
Overview
‘rails generate sessions:views` — eject the engine’s overridable templates into the HOST app so they can be restyled. This is the Devise move (‘rails g devise:views`), and it works for the same boring Rails reason: the host app’s ‘app/views` sits AHEAD of any engine’s view paths in the lookup chain, so a file copied to e.g. ‘app/views/sessions/_device.html.erb` SHADOWS the gem’s bundled default automatically — no config, no registration. Delete your copy and the gem’s default comes back. Upgrade the gem and your ejected copies are untouched (re-run only if you WANT the new defaults).
Instance Method Summary collapse
Instance Method Details
#copy_views ⇒ Object
21 22 23 |
# File 'lib/generators/sessions/views_generator.rb', line 21 def copy_views directory ".", "app/views/sessions" end |
#show_styling_tip ⇒ Object
25 26 27 28 29 30 |
# File 'lib/generators/sessions/views_generator.rb', line 25 def show_styling_tip say "\n🎨 Views copied to app/views/sessions/. They render with the gem's" say " bundled sessions.css by default; restyle freely — if your app uses" say " Tailwind, classes you add here are picked up by your build" say " automatically (the files now live in app/views)." end |