Created
December 3, 2011 18:30
-
-
Save spacecowb0y/1427773 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Customizing the form | |
form do |f| | |
f.inputs "Customer" do | |
f.input :user, :as => :select, :collection => User.find(:all, :order => "created_at ASC").map{ |u| [u.email, u.id] } | |
end | |
f.inputs do | |
f.input :category, :as => :select, :collection => Project.category_collection | |
f.input :status, :as => :select, :collection => Project.status_collection | |
f.input :due_date | |
end | |
f.inputs "Order Details" do | |
f.has_many :orders do |i| | |
i.input :tax, :label => "Timeframe", :as => :select, :collection => Order.timeframe_collection | |
i.has_many :sales_products do |i| | |
i.input :product_id, :as => :select, :collection => Product.where(:status => 0).map {|p| [p.title, p.id]} | |
i.input :quantity | |
end | |
end | |
end | |
f.inputs "Assign to" do | |
f.has_many :assignments do |i| | |
i.input :_destroy, :as => :boolean, :label => "Delete this item" unless i.object.object_id.nil? | |
i.input :employee_id, :as => :select, :collection => Employee.find(:all).map {|e| [e.user.email, e.id]} | |
end | |
end | |
f.buttons | |
end | |
# { | |
# "utf8" = >"✓", | |
# "authenticity_token" = >"ouXNPnL/mVfmsBkB6hg0UQF3EUAA0oO4TF3QGiRJP4M=", | |
# "project" = >{ | |
# "user_id" = >"77", | |
# "category" = >"0", | |
# "status" = >"0", | |
# "due_date(1i)" = >"2010", | |
# "due_date(2i)" = >"9", | |
# "due_date(3i)" = >"16", | |
# "due_date(4i)" = >"18", | |
# "due_date(5i)" = >"25", | |
# "orders_attributes" = >{ | |
# "1322935587045" = >{ | |
# "tax" = >"1" | |
# }, | |
# "1322935589001" = >{ | |
# "sales_products_attributes" = >{ | |
# "1322935589001" = >{ | |
# "product_id" = >"2", | |
# "quantity" = >"1" | |
# } | |
# } | |
# } | |
# } | |
# }, | |
# "commit" = >"Create Project" | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment