Rails Devise/Invitable -
i have rails app devise , devise_invitable (links official docs on overriding controllers), have made devise_invitable invitations_controller.rb
display list of invited users within devise/invitations/new.html.erb. both devise , devise_invitable views in app/views/devise
, app/views/devise/invitations
respectively , devise/devise_invitable controllers in app/controllers/users/
. rails throws undefined method 'each' nilclass
in invitations/new
view in loop:
# app/views/devise/invitations/new.html.erb <% @invited_users.each |invited| %> omitting code... <% end %> # app/controllers/users/invitations_controller.rb class users::invitationscontroller < devise::invitationscontroller def new super # not empty, returns multiple records in console @invited_users = user.where.not(invitation_sent_at: nil) end end # config/routes.rb ... devise_for :users, controllers: { registrations: 'users/registrations', invitations: 'users/invitations' } ... end
the weird thing when change app/views/devise folder name app/views/users, error gone , displays current invited users creates larger problem app uses both devises/devise_invitable's default views.
turns out culprit super statement, render being called never got @invited_users, moved below
Comments
Post a Comment