jeudi 22 octobre 2015

nested namespace on form_for helper method - Rails

Hello guys so i have two namespaces, one nested inside another of the form

admin (namespace) inside admin i have blog (namespace)

i know that i can put the namespace like below in the form-for helper.

<%= form_for [:blog, @post] do |f| %>
  <%= render 'shared/error_messages', object: f.object %>
  <div class="large-12 columns">
    <div class="field panel">
      <%= f.label :title %><br>
      <%= f.text_field :title %>
    </div>

    <div class="field panel">
      <%= f.label :body %><br>
      <%= f.text_field :body %>
    </div>

    <div class="actions">
      <%= f.submit %>
      <%= link_to 'Back', admin_blog_posts_path %>
    </div>
  </div>

<% end %>

but how can i also prefix :admin namespace in front of that?

Aucun commentaire:

Enregistrer un commentaire