Displaying 1 result from an estimated 1 matches for "find_by_default_category".
2005 Dec 17
1
Adding model attribute without db field
...t in the usual Ruby
way, I get a ''number of redirects exceeded'' error.
Here is my code;
The model;
class Category < ActiveRecord::Base
attr :status
end
The controlller;
if params[:id] then @category = Category.find(params[:id])
else @category = Category.find_by_default_category(''1'')
end
@category.status = 1
The view (just to access it)
<% for category in @categories %>
<%= category.status %>
etc...
So, is there a way to add an attribute to an existing table based model?
--
Posted via http://www.ruby-forum.com/.