Im running into a small (newbie) problem.
I've got 2 models: question & reviews.
Reviews schema: question_id, user_id, rating, comments
On the 'show' view, i've integrated the following form (formtastic):
- semantic_form_for @question.reviews.build do |f|
= f.error_messages
= f.input :rating
= f.input :comments
= f...
I have a subject model with two fields - "name" and "level". I want to be able to visit "/subjects#new" and add 10 subjects objects at once. How can I do this in formtastic.
In regular forms I would do this:
<% @subjects.each do |s| %>
<% fields_for "subject[#{s.id}]", s do |f|%> ...
I am using Formtastic and I have a simple boolean field. In my view, I have
<%= f.input :active, :label => "Enabled?", :as => :select, :include_blank => false, :collection => [ ["Yes", true], ["No", false] ] %><br />
It saves to the database just fine. But when it loads, it always shows the first value ("Yes").
What am I mi...
I have a rubygem that defines a custom SemanticFormBuilder class which adds a new Formtastic input type. The code works as expected, but I cannot figure out how to add tests for it. I was thinking I could do something like load up Formtastic, call semantic_form_for, and then ad ann input that uses my custom :as type, but I have no idea w...
Why can't I add new items to my database using a has_many :through relationship? I am missing something, the form shows up right, but I just can't add anything to my database. I hit enter and nothing happens.
I'm running mysql / rails3 / using formtastic.
Subscriber.rb (Subscriber model)
class Subscriber < ActiveRecord::Base
attr_acc...
Model has accepts_nested_attributes_for for the relation and the form is as follows:
= semantic_form_for @obj, :url => path do |f|
= f.inputs do
= f.input :name
= f.semantic_fields_for :photos do |p|
= p.inputs :desc
= f.buttons
The form works well and everything is fine. However, I would like to display each phot...
I'm a bit stuck on a 'has_one' and 'belongs_to' relationship and getting it to properly display in Formtastic. I have a person model that has one picture (a profile picture). I want the user to be able to select the picture using radio buttons. So far, I have:
<% form.inputs do %>
<%= form.input :picture, :as => :radio, :collection =>...
I've been trying to figure this one out for a while but still no luck. I have a company_relationships table that joins Companies and People, storing an extra field to describe the nature of the relationship called 'corp_credit_id'. I can get the forms working fine to add company_relationships for a Person, but I can't seem to figure out ...
Hi guys
I am trying I have a simple one-to-many association. I am trying to update photos that belong to an album through a nested form:
The edit form for the photo album:
<%= semantic_form_for(@album, :url => user_album_path(@user, @album), :html => {:method => :put} ) do |f| %>
<%= f.inputs do %>
<%= f.input :title %>
<%= f.in...