I'm using ActiveScaffold in a Rails 3 project. I have a layout which yields the default AS views, configured the following way:
layouts/admin.html.erb
<%= render :partial => "layouts/admin_header" %>
[some html]
<%= yield %>
[more html]
<%= render :partial => "layouts/admin_footer" %>
I then use a BaseController, which renders this layout
class Admin::BaseController < ApplicationController
[some global settings / restrictions]
layout "admin"
end
Now, In my model-specific controller, I just use:
class Admin::UsersController < Admin::BaseController
active_scaffold :user do |config|
config.columns[:id].label = "#"
[more config]
end
def conditions_for_collection
[setting some conditions]
end
end
Thats all working fine. Now what I would like to do is pass and display a param to the layouts/admin view.
Usually it would be sufficient to set an instance variable in the controller action @my_var = params[:some_param]
, but the controller action is inside AS. If I set it somewhere else, it wont be passed to the view. So I tried implementing the controller action (I want to change the display for the user list action):
def list
@my_var = "test"
render :active_scaffold => "users"
end
I was hoping to be able to tell AS to use it's default view to render the list with render :active_scaffold => "users"
, but unfortunately that doesn't work, I'm getting
ActionView::MissingTemplate
Missing template admin/users/index, admin/base/index, application/index, active_scaffold_overrides/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :haml]}
If I leave out the render call, I'm getting the same result. So my question is: how can I either pass a param without overwriting the controller method, or instruct AS to use the default view in my controller action?