Skip to content
Andreas Dausenau edited this page Apr 26, 2022 · 3 revisions

ezuser - generator

This generator ejects everything related to the user. This generator can be used if you want to customize the user model, e.g. to add more fields, validators or hooks to the user.

rails generate ez_on_rails:ezuser

We recommend to highlight your changes to be able to apply updates from ez-on-rails.

The following steps are executed by the generator

1. Copy the controllers

  • The user controllers for the administration are are located in app/controllers/users
    • Note that this are the (devise)[https://github.com/heartcombo/devise] controllers with some adjustments
  • The user controller for the api is located in app/controllers/api/users_controller.rb

2. Copy the helper

  • The helper is located in app/helpers/users_helper.rb
  • The helper contains the render info method for the user management views like registration, login etc.

3. Copy the views

  • The html views for the user management are located in app/views/users
  • The json views for the api are located in app/views/api/users

4. Copy the model

  • The user model is located in app/models/user.rb

5. Copy locale files

  • The locales for the custom user actions are located in config/locales/users
  • The locales related to devise for user management are located in config/locales/devise.de.yml and config/locales/devise.en.yml

6. Copy the specs

  • The model spec to test the active record user model is located in spec/models/user_spec.rb
  • The request specs to test the user related actions is located in spec/requests/users
  • The request spec to test the user related api actions is located in spec/requests/api/users_spec.rb