Collection option for semantic_fields_for #913

pduersteler opened this Issue Jan 24, 2013 · 2 comments

3 participants


Let's say you have a form for @project and want to provide a form to add/edit multiple tasks at once.

f.inputs for: :tasks do |t|
  t.input :name

This renders all available tasks in @project. However, if you want to limit the tasks by a collection you are building (to create) or fetching (to update), – e.g. a collection of tasks you have selected previously to mass-edit – you don't have a "formtastic-native" option to define the collection.

DSL I am talking about:

f.inputs for: :tasks, collection: @my_tasks_collection do |t|
  t.input :name

Would that be in the proper sense of @justinfrench / formtastic? If yes, I'd go for that feature. Or is there already a solution to this (which I just haven't found)?


f.semantic_fields_for :tasks, @some_tasks works for me (just passing the collection as a second argument). This mirrors the built-in fields_for. Not sure if there is currently a way to do the same thing with inputs.


@pduersteler The API you've proposed sounds pretty good. AS @grantovich pointed out, there is a work-around. Would love to see a pull-request for your improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment