lib/generators/sufia/models/install_generator.rb in sufia-models-3.4.0 vs lib/generators/sufia/models/install_generator.rb in sufia-models-3.5.0
- old
+ new
@@ -53,10 +53,10 @@
# Add behaviors to the user model
def inject_sufia_user_behavior
file_path = "app/models/#{model_name.underscore}.rb"
if File.exists?(file_path)
- inject_into_class file_path, model_name.classify do
+ inject_into_file file_path, after: /include Hydra\:\:User.*$/ do
"# Connects this user object to Sufia behaviors. " +
"\n include Sufia::User\n"
end
else
puts " \e[31mFailure\e[0m Sufia requires a user object. This generators assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \b rails -g sufia client"