Define a render action with params

Hello there,

i'm trying to set a render action for an index page, it works fine without parameters but i can't seem to set some correctly.

i would like the render to call the list method with the parameters artist_cat = 1

that would be the equivalent of this : "list?artist_cat=1"

any ideas ?
class Admin::ArtistsController < ApplicationController
  
  layout "admin"
  
  before_filter :check_authentication
  
  def index
    list
    render :action => 'list', :artist_cat => '0'
  end
 
  # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
  verify :method => :post, :only => [ :destroy, :create, :update ],
         :redirect_to => { :action => :list }
 
  def list
    #@artist_pages, @artists = paginate :artists, :per_page => 10
    @artists = Artist.find(:all, :conditions => ["artist_cat = ?", params[:artist_cat]], :order => "name")
    #@artists = Artist.find(:all, :order => "artist_cat, name")
  end

Open in new window

LVL 1
terencepiresAsked:
Who is Participating?
 
Andrew DoadesIT TechnicianCommented:
Try just the number on its own, without the '' ..

render :action => 'list', :artist_cat => 0
0
 
terencepiresAuthor Commented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.