class Project < ActiveRecord::Base
has_one :template
end

class Template < ActiveRecord::Base
belongs_to :project, foreign_key: "project_id"
end

When you create a new project I'd like you to select the template from
a collection of existing templates (created by an admin).

The new project.template should have all of the template's attributes
(clients, tasks etc) and these should be editable without affecting
the original template (a completely new instance).

My difficulty has been in moving all of the template's params through
the select input from a form.

My current (very poor) attempt at the form looks like this:

= simple_form_for @project do |f|
#### project stuff here #####
= simple_fields_for "project[template_attributes]",
@project.build_template do |project_form|
= project_form.input :title, collection: @templates

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 31, '12 at 10:37a
activeJan 31, '12 at 10:37a
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Vladiim: 1 post

People

Translate

site design / logo © 2021 Grokbase