Bill,

that's what I thought. My model is called 'City', the controller is 'class 
Admin::CitiesController < Admin::ResourceController'

What I want to create is a class City which has content parts just like Page, 
with filters and tag reference and everything. I assumed that it would be just 
like with Page and PagePart, so I created City and CityPart.

The model itself works as expected, but I'm fighting with the controller, esp. 
with the render_region method which is implemented in regions_helper.rb. When I 
call it for whatever region in a template of my custom controller, it gives me:

> undefined method `cities' for #<Radiant::AdminUI:0x102036cd8>
> 
> Extracted source (around line #5):
> 
> 2: 
> 3: <h1>Cities</h1>
> 4: 
> 5: <%= render_region :top %>
> 6: 
> 7: <p>Some description</p>
> 8: 

Maybe I've got some naming wrong here, but according to the source code of 
pages_controller.rb and page_parts_controller.rb I'm all set. I'm rather 
clueless as to where to search for a solution next, so any help is greatly 
appreciated. Regards,

Christian

Am 06.02.2010 um 21:29 schrieb Bill:

> Christian,
> 
> Admin::ResourceController gives you CRUD methods so you don't have to define 
> them yourself. Methods like  :index, :edit, :update, :new, :create, :delete  
> are built in.
> 
> So on a plugin I am working on I only define the show method (controller for 
> a podcast's Shows) to get a single 'Show' in my podcast...
> 
> class Admin::ShowsController < Admin::ResourceController
>  model_class Show
> 
>  before_filter :find_model, :only => [ :show ]
> 
>  def show
>    respond_to do |format|
>      format.html # show.html.erb
>      format.xml  { render :xml => @show }
>    end
>  end
> 
>  private
>    def find_model
>      @show = Show.find(params[:id]) if params[:id]
>    end
> 
> end
> 
> Regards,
> 
> -Bill
> pixelhandler

_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org

Reply via email to