Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Define a render action with params

Posted on 2009-05-02
Medium Priority
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 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")

Open in new window

Question by:terencepires
LVL 10

Accepted Solution

Andrew Doades earned 2000 total points
ID: 24285715
Try just the number on its own, without the '' ..

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

Author Closing Comment

ID: 31577151

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: narshlob
If you've ever programmed in Ruby and have come across either a proc or a lambda, you might have been wondering what the difference is between the two and when you would use one over the other. This article will try to explain the difference between…
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…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

571 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