samedi 31 octobre 2015

Trying to customize devise views in Rails

So, basically I have 2 users in my app, they are Company and Establishment.

The problem is that I want to customize the edit view for each one of them, but edit_company_registration and edit_establishment_registration are rendering views/devise/registrations/edit.html.erb instead of views/company/registrations/edit.html.erb and views/establishment/registrations/edit.html.erb respectively, so I can't customize each one of them separately, and in addition to that problem whenever I try to edit a record (Company or Establishment) I get this error.

enter image description here

I don't know why is this happening (and I obviously fill all the fields), I don't know if this is part of the effect of the above (the fact that links to edit_company_registration and edit_establishment_registration are rendering views/devise/registrations/edit.html.erb).

Telling a little what I did, I used this command:

rails generate devise:views

To have the views of devise in app/views/company and app/views/admin like this:

enter image description here

But as I said, if I try to go to edit_establishment_registration or edit_company_registration it will render devise/registrations#edit instead of establishment/registrations/edit.html.erb and company/registrations/edit.html.erbrespectively, how can I fix this (or these) problem?, I need help please.

If you are little confused, this is what I want to do:

  1. Be able to customize each edit view separately, for this I guess I have to somehow make it render views/establishment/registrations/edit.html.erb from edit_establishment_registration (same case for company).
  2. Fix the problem that tells me that the password can't be blank (Maybe it's a side effect of the fact that both edit_company_registration and edit_establishment_registration are rendering views/devise/registrations/edit.html.erb, I don't know).

Greetings.

Aucun commentaire:

Enregistrer un commentaire