How to set a resource in another controller?

I am trying to display a view of the default edit registration in modal mode. The modal is called from another controller .. Home_controller in this case.

I have <% = render: template, 'devise / registrations / edit'%> in my modal tag, and it is called when the mod’s launch button is clicked, but the rails through me use the undefined variable method as regards resource usage. I know that a resource is just a user-defined object, but the home compiler does not know how to solve it, I thought that the rendering template method allows this resolving rail to use the application registration controller.

Any ideas? Im really eanting to keep deafault designing a controller to simplify future functions? How to cause viewing from another controller in one controller, allowing you to use all the actions in the called controller.

+4
source share
1 answer

Try adding this to application_helper.rb (from The Devise Wiki )

def resource_name :user end def resource @resource ||= User.new end def devise_mapping @devise_mapping ||= Devise.mappings[:user] end 
+8
source

Source: https://habr.com/ru/post/1410886/


All Articles