How to have one resource in routes for namespace and root path altogether - Rails 4
Oh wait ! There's also the possibility to use concerns !
concern :shared_actions do
resources :courses
resources :something_else
end
namespace :admin do
concerns :shared_actions
end
concerns :shared_actions # Will add it to the root namespace ^^
EDIT : apparently this is what this guy also tried to do :D
Rails routing: add (shallow) concern to root
Just write concerns: :namespaceable
in the main file
Rails.application.routes.draw do
concern :namespaceable do
resources :comments do
resources :replies
...
end
concerns: :namespaceable # Will add to root namespace
end
Using same form and form_for in Rails with nested resources in namespace
Put the common features of the form inside the partial, and wrap it in the individual form_for
:
<%= form_for [:admin, foo] do |f| %>
<%= render "foos/form", f: f %>
<% end %>
And:
<%= form_for [foo] do |f| %>
<%= render "foos/form", f: f %>
<% end %>
Related Topics
Rails Elasticsearch Aggregation
How to Restart Rails from Within Rails
Port in Use When Not Using a Port
Finding the Difference Between Strings in Ruby
How to Share Worker Among Two Different Applications on Heroku
Ruby on Rails: Two References with Different Name to the Same Model
When Trying to Generate a Model with Rails and Postgresql, the Command Hangs Without Error
Generate a 'Link_To' to the Controller Action 'Edit', Dynamically
Ways to Define a Global Method in Ruby
Coping with "String Contains Null Byte" Sent from Users
Access Localhost on MAC from Xcode? Phonegap Communicating with Ajax to a Local Rails App
Detecting Linux Distribution/Platform in Ruby
Using Authlogic_API for Rails Rest API Access
Argument Out of Range Rails 4 and Bootstrap3-Datetimepicker-Rails
Postgresql Ilike with Multiple Matches in Rails Activerecord