ruby - nested namespace on form_for helper method - Rails -


hello guys have 2 namespaces, 1 nested inside of form

admin (namespace) inside admin have blog (namespace)

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

<%= form_for [:blog, @post] |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 prefix :admin namespace in front of that?

found it.

for future reference

you add comma depending on order of namespaces

in case above

<%= form_for [:admin,:blog, @post] |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> 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -