Define a render action with params

Posted on 2009-05-02
Last Modified: 2013-11-13
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


    render :action => 'list', :artist_cat => '0'


  # GETs should be safe (see

  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")


Open in new window

Question by:terencepires
    LVL 10

    Accepted Solution

    Try just the number on its own, without the '' ..

    render :action => 'list', :artist_cat => 0
    LVL 1

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I recently rediscovered rails when I needed a holiday project and decided to build a management dashboard for the company where I work.  With it being a project done in my free time, I could focus my time on learning the basics rather than trying to…
    Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now