mercredi 26 janvier 2022

undefined method for #

I have User(has_one :profile, as: :profilable), Profile(has_many :privacies and accepts_nested_attributes_for :privacies) and Privacy(belongs_to :profile).

Routes:

get   "/u/edit/privacies",     action: :privacies,           as: :edit_user_privacies
patch "/u/edit/privacies",     action: :update_privacies,    as: :update_user_privacies

Controller:

def privacies
  respond_with @user
end

View:

<%= simple_nested_form_for @user.profile, as: :profile_privacies, url: update_user_privacies_path do |privacie_form| %>

        <div class="row">
            <div class="col-xs-12 col-md-6 text-muted text-semibold">
                Marque as opções de preferência para sua privacidade.
            </div>
        </div>

        <%= privacie_form.fields_for :privacies do |privacy| %>

            <div class="row">
                <div class="col-xs-12">
                    <h3 class="section-title">Fotos</h3>
                    <hr class="section-divider" style="margin-bottom:10px;"/>
                </div>
                <div class="col-xs-12">
                    <%= privacy.pictures as: :check_boxes, collection: Database::Privacy.kinds, label: false, wrapper: :default_checkbox_form %>
                </div>
            </div>

Aucun commentaire:

Enregistrer un commentaire