formtastic

Why is accepts_nested_attributes_for not working for me? (rails 3)

痞子三分冷 提交于 2019-12-24 00:44:13
问题 I'm using formtastic and haml on a Rails 3 application. I'm trying to make a nested form for surveys and questions, but it's just not working for me. I've watched the railscast and on it and everything, but I can't seem to make it work for my application. So right now, I have the following: models class Survey < ActiveRecord::Base attr_accessible :intro, :name, :pubdate, :enddate, :pubid belongs_to :user has_many :questions, :dependent => :destroy, :autosave => true accepts_nested_attributes

Using fields from an association (has_many) model with formtastic in rails

冷暖自知 提交于 2019-12-23 07:38:18
问题 I searched and tried a lot, but I can't accomplish it as I want.. so here's my problem. class Moving < ActiveRecord::Base has_many :movingresources, :dependent => :destroy has_many :resources, :through => :movingresources end class Movingresource < ActiveRecord::Base belongs_to :moving belongs_to :resource end class Resource < ActiveRecord::Base has_many :movingresources has_many :movings, :through => :movingresources end Movingresources contains additional fields, like quantity . We're

undefined method `has_many' for Formtastic

你。 提交于 2019-12-21 12:59:48
问题 I'm getting this error : undefined method `has_many' for #<Formtastic::SemanticFormBuilder:0xb410d4c> It work when I use it like this : ActiveAdmin.register Ressource do form do |f| f.inputs do f.input :offer_id, :as => :hidden f.input :name f.input :category, :include_blank => false, :collection => Category.order('place ASC').all, :member_label => :to_label f.input :description, :input_html => {:class => 'editor'} f.input :price end f.has_many :roles do |app_f| app_f.inputs do if not app_f

Accessing object of form in formtastic

你。 提交于 2019-12-21 07:54:48
问题 So I'm making a survey app. The users choose a type of form on the backend, and it displays as a certain type on the front end. That's only ideally, of course. What happens now is I can't access the object formtastic is building the form for. How can I say something like "question.kind"? It just makes an error that way. Here's what I have so far... = semantic_form_for @survey, :url => "#", :html => { :method => "get" } do |f| - for question in @survey.questions = user_facing_question(f) and

Accessing object of form in formtastic

戏子无情 提交于 2019-12-21 07:53:55
问题 So I'm making a survey app. The users choose a type of form on the backend, and it displays as a certain type on the front end. That's only ideally, of course. What happens now is I can't access the object formtastic is building the form for. How can I say something like "question.kind"? It just makes an error that way. Here's what I have so far... = semantic_form_for @survey, :url => "#", :html => { :method => "get" } do |f| - for question in @survey.questions = user_facing_question(f) and

ActiveAdmin - Using scopes with filters

家住魔仙堡 提交于 2019-12-20 23:24:07
问题 In my ActiveAdmin model I have a custom scope to show deleted records and several filters for searching records by specific columns. Using the filters individually or combined together works as expected. Using a scope works as expected. The problem is that using a scope seemingly overrides all the filters and after selecting a scope any filter added does nothing. Anyone have any ideas here? What I want is to be able to show a specific scope and then still be able to filter results within that

HTML - Correct way of coding a checkbox with a Label

五迷三道 提交于 2019-12-18 19:33:03
问题 I've been using formtastic in order to generate HTML forms on rails applications. My question, however, is really HTML-related. Today I found a strange behaviour on the way formtastic generates checkboxes (fields of type :boolean on formtastic lingo). The rest of the fields (non-checkboxes) are generated this way: <li> <label for="my_textbox_field">My TextBox</label> <input id="my_textbox_field" type="text" ... > </li> Checkboxes, however, are enclosed inside their <label> tags completely -

HTML - Correct way of coding a checkbox with a Label

青春壹個敷衍的年華 提交于 2019-12-18 19:32:12
问题 I've been using formtastic in order to generate HTML forms on rails applications. My question, however, is really HTML-related. Today I found a strange behaviour on the way formtastic generates checkboxes (fields of type :boolean on formtastic lingo). The rest of the fields (non-checkboxes) are generated this way: <li> <label for="my_textbox_field">My TextBox</label> <input id="my_textbox_field" type="text" ... > </li> Checkboxes, however, are enclosed inside their <label> tags completely -

Formtastic / rails forms not submitting

依然范特西╮ 提交于 2019-12-14 03:57:56
问题 I am trying to use formtastic to make a form where I can enter an :opposition choose a :venue and a :team and then be presented with a list of players that I am able to check off to select them for the I have got the form set up so it renders correctly however when submitted it does not save any information and just reloads the page. My code is at my github here: https://github.com/jpknegtel/st_francis models This concerns the following models: player has_many :player_fixtures has_many

Default value for date_helper in formtastic

拈花ヽ惹草 提交于 2019-12-14 01:05:25
问题 As basic as it sounds, I can't make the date_helper default to a date, as in: - semantic_form_for resource do |f| - f.inputs do = f.input :issued_on, :default => Date.today = f.buttons The above just renders blank columns if resource does not have a date. Would appreciate any pointer on what I'm possibly doing wrong. 回答1: We've recently implemented a :selected option against all :select, :radio and :check_boxes inputs in Formtastic, so it'll be in the next patch release (0.9.5) or 1.0. Until