@@ -34,13 +34,6 @@ def generate_devise_assets
3434 generate "devise" , model_name . classify
3535 generate "devise_guests" , model_name . classify
3636
37- # add the #to_s to the model.
38- insert_into_file ( "app/models/#{ model_name } .rb" , before : /end(\n | )*$/ ) do
39- "\n # Configuration added by Blacklight; Blacklight::User uses a method key on your\n " \
40- " # user class to get a user-displayable login/identifier for\n " \
41- " # the account.\n " \
42- " self.string_display_key ||= :email\n "
43- end
4437 gsub_file ( "config/initializers/devise.rb" , "config.sign_out_via = :delete" , "config.sign_out_via = :get" )
4538 end
4639
@@ -49,13 +42,19 @@ def inject_blacklight_user_behavior
4942 file_path = "app/models/#{ model_name . underscore } .rb"
5043 if File . exist? ( File . expand_path ( file_path , destination_root ) )
5144 inject_into_class file_path , model_name . classify do
52- "\n # Connects this user object to Blacklights Bookmarks." \
53- "\n include Blacklight::User\n "
45+ <<~EOS
46+ # Connects this user object to Blacklights Bookmarks.
47+ include Blacklight::User
48+
49+ # Blacklight::User uses a method on your User class to get a user-displayable
50+ # label (e.g. login or identifier) for the account. Blacklight uses `email' by default.
51+ # self.string_display_key = :email
52+ EOS
5453 end
5554 else
5655 say_status "warning" , <<~EOS , :yellow
5756 Blacklight authenticated user functionality not installed, as a user model
58- could not be found at /app/models/user.rb . If you used a different name,
57+ could not be found at #{ file_path } . If you used a different name,
5958 please re-run the migration and provide that name as an argument. E.g.:
6059
6160 `rails -g blacklight:user client`
0 commit comments