I have several questions at once:

  1. Added name ( string ) and phone ( integer ) attributes to Devise. When sending a form, it gives the errors "Name can't be blank" and "Phone can't be blank", although the fields are filled.
  2. How to replace labels (for example, translate into Russian)? When I change :name to :ФИО - everything is fine, but when I change the rest, it gives an error.

The form itself:

 <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :role => 'form'}) do |f| %> <h3>Регистрация</h3> <%= devise_error_messages! %> <div class="form-group"> <%= f.label :name %><br /> <%= f.text_field :name, autofocus: true %> </div> <div class="form-group"> <%= f.label :email %><br /> <%= f.email_field :email %> </div> <div class="form-group"> <%= f.label :phone %><br /> <%= f.text_field :phone %> </div> <div class="form-group"> <%= f.label :password %> <%= f.password_field :password, class: 'form-control' %> </div> <div class="form-group"> <%= f.label :password_confirmation %> <%= f.password_field :password_confirmation, class: 'form-control' %> </div> <%= f.submit 'Sign up', :class => 'button right' %> <% end %> 
  • one
    Under each of the questions is better to start a separate topic. So you can more accurately name the question, get more quality answers and make it easier for other participants who find themselves to face the same problem. - cheops

1 answer 1

Added name ( string ) and phone ( integer ) attributes to Devise. When sending a form, it gives the errors "Name can't be blank" and "Phone can't be blank", although the fields are filled.

Most likely, you stepped on the same rake that I once did, forgetting about the Strong Parameters.

How to replace labels (for example, translate into Russian)? When I change :name to :ФИО - everything is fine, but when I change the rest, it gives an error.

Of course, gives. It should be 'ФИО' , not :ФИО and so on. Keys begin with a colon, and you need to specify a specific string value. However, if you are going to translate, it is better to start using the internationalization API right away.