Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

the goodness

  • Loading branch information...
commit a627992818e882592dc026c98191abc9162a90b6 1 parent 1329ca8
Matt Hodgson authored
View
1  app/controllers/topics_controller.rb
@@ -11,7 +11,6 @@ def index
def new
@topic = Topic.new
- @topic.property_types.build
if params[:tag_id]
@tag = Topic.find(params[:tag_id])
@topic.tags << @tag
View
2  app/models/topic.rb
@@ -15,7 +15,7 @@ def properties_to_use
def setup_properties
properties_to_use.each do |property_type|
- properties << Property.new(:property_type_id => property_type.id) unless property_type_ids.include?(property_type.id)
+ properties.build(:property_type_id => property_type.id) unless property_type_ids.include?(property_type.id)
end
end
View
21 app/views/topics/_form.html.haml
@@ -6,25 +6,28 @@
%br
#properties
-@topic.properties.each do |property|
- -f.fields_for :properties, property do |p|
- -Rails.logger.info(property.inspect)
- =p.label property.property_type.name
+ -f.fields_for :properties, property do |pf|
+
+ =label_tag property.property_type.name
%br
- =property_edit p
+ =property_edit pf
+ %br
+ %br
+ =pf.text_field :property_type_id
%br
%br
#property_types
- -f.fields_for :property_types do |pf|
+ -f.fields_for :property_types do |pt|
- =pf.label 'Property Name'
+ =pt.label 'Property Name'
%br
- =pf.text_field :name
+ =pt.text_field :name
%br
%br
- =pf.label 'Property Type'
+ =pt.label 'Property Type'
%br
- =pf.select :type_name, PropertyType::VALID_TYPES
+ =pt.select :type_name, PropertyType::VALID_TYPES
%br
%br
Please sign in to comment.
Something went wrong with that request. Please try again.