On 29 June 2010 02:56, RailsFan Radha <[email protected]> wrote:
>
> I have a table called category and i want to show only the records where
> "status = A" in my list.erb
>
> currently, my list.erb shows all records from category table.
> but, i would like to show only the records where status = 'A'
>
> for example:
> select * frm category where status = 'A'
>
> the idea behind this is, i have this status column to show only the
> active records.
> This status flag accepts,
> "A" for active,
> "I" for inative and
> "R" for "Requested newly, but not yet processed".
> .. and may be others as per the futurre needs.
>
> so how can i apply this filter of where status = 'A' in my controller.
>
>  def list
>     �...@categories=category.find_all_categories
>        end
>

I think it would be worth your while working through some tutorials
and guides.  Have a look at the guides at
http://guides.rubyonrails.org/ for a start.  Agile Development with
Rails is an excellent book.  The tutorial at
http://www.railstutorial.org/ is good.  Make sure that any tutorial
you try is for rails 2.3.

For your particular problem I would suggest using named_scope.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to