RailsFan Radha 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'
select * frm category where status = 'A'
the idea behind this is, i have this status column to show only the
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.
Added another method to the model,
find_by_sql("SELECT * from category
where status = 'A')
order by category_id ")
And changed the controller, list action to call this new method.
And this seems to be working.
Let me know if i have missed any or please add any additional info which
this implies too.