end
def edit
- @categories = DocumentCategory.all
+ @categories = DocumentCategory.active #TODO: use it in the views
if request.post? and @document.update_attributes(params[:document])
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :id => @document
<div class="box">
<!--[form:document]-->
<p><label for="document_category_id"><%=l(:field_category)%></label>
-<%= select('document', 'category_id', DocumentCategory.all.collect {|c| [c.name, c.id]}) %></p>
+<%= select('document', 'category_id', DocumentCategory.active.collect {|c| [c.name, c.id]}) %></p>
<p><label for="document_title"><%=l(:field_title)%> <span class="required">*</span></label>
<%= text_field 'document', 'title', :size => 60 %></p>
type: IssuePriority
position: 6
active: false
+enumerations_016:
+ name: Inactive Document Category
+ id: 16
+ type: DocumentCategory
+ active: false
assert_tag :select, :attributes => {:name => 'document[category_id]'},
:child => {:tag => 'option', :attributes => {:selected => 'selected'},
:content => 'Technical documentation'}
+
+ assert ! DocumentCategory.find(16).active?
+ assert_no_tag :option, :attributes => {:value => '16'},
+ :parent => {:tag => 'select', :attributes => {:id => 'document_category_id'} }
end
def test_index_with_long_description