Warning: Creating default object from empty value in /homepages/39/d161420129/htdocs/p373.net/wp/wp-content/themes/p373b/admin/functions.php on line 183
Global Technology, Activism, Philosophy, Photography.

Monthly Archives: November 2012

ProTip: Don’t name your namespaced controllers “ApplicationController”

Don’t do this: class Admin::ApplicationController < ApplicationController layout "admin" end class Admin::IndexController < Admin::ApplicationController end This works for the most part except that the layout is not chosen properly.  Rails just chooses the default application.html.erb layout. Instead, rename to something like this: class Admin::BaseController < ApplicationController layout "admin" end class Admin::IndexController < Admin::BaseController end you’re […]

Posted in Coding, Ruby/Rails, Technology | Tagged , , , , | Comments closed

Rails Nested Resource Controllers – what not to do when testing

Testing nested resource controllers is pretty easy and awesome.  It is not easy and awesome, however, if the name of your nested controller differs from the route you want to use. Examine the following resources :posts do resources :comments, controller: "UserComments" end Did you catch whats wrong with the above?  You may not actually run […]

Posted in Coding, Ruby/Rails, Technology | Comments closed