formtastic

fields for images don't displays in active admin form

强颜欢笑 提交于 2019-12-07 14:41:12
问题 gem "formtastic", "~> 2.1.1" gem "activeadmin", "~> 0.4.2" gem "paperclip" fields for photos don't displays in active admin form app/views/admin/products/_form.html.erb ,but the same form in app/views/products/_form.html.erb works correctly in product's views > app/admin/products.erb ActiveAdmin.register Product do form :partial => "form" end app/views/admin/products/_form.html.erb <%= semantic_form_for [:admin , @product ], :html => { :multipart => true } do |f| %> <%= f.semantic_errors

Using font awesome with formtastic submit button

若如初见. 提交于 2019-12-07 07:04:53
问题 I have a submit button on my form: = semantic_form_for record do |form| = form.actions do = form.submit 'Save' I want to add an icon from FontAwesome, with link_to I can use a block: = link_to record do = fa_icon 'save' Save But this doesn't work with Formtastic's form.submit . I also tried: = form.submit fa_icon('save') = form.submit fa_icon('save').html_safe But both renders escaped HTML. How do I add a font-awesome icon to the <button> tag? 回答1: Try using capture to set a label, as in: -

Formtastic number field with decimal precision?

人盡茶涼 提交于 2019-12-07 05:00:55
问题 Surely I'm missing something pretty obvious... I have a field that is decimal with precision 2, but Formtastic is displaying it with only a single decimal, unless the actual value has 2 places. What am I missing? Model: create_table "items", :force => true do |t| t.string "item_number" t.integer "buyer_id" t.integer "seller_id" t.string "description" t.decimal "sales_price", :precision => 10, :scale => 2, :default => 0.0 t.datetime "created_at" t.datetime "updated_at" end View %td= bought

Activeadmin and Formtastic: form not responding to :size

杀马特。学长 韩版系。学妹 提交于 2019-12-06 22:49:59
问题 I am trying to format a form and the text fields respond to some methods, and not others. I can do things like: f.input :name, :input_html => { :maxlength => 10 } f.input :name, :input_html => { :disabled => true } But if I try to do any of the following, they do not work: f.input :name, :input_html => { :size => 10 } f.input :name, :input_html => { :class => 'autogrow' } f.input :name, :input_html => { :rows => 10, :cols => 10 } When I try using :size, for instance, the generated html shows

Using HABTM or Has_many through with Active Admin

安稳与你 提交于 2019-12-06 00:48:33
I've read quite a few of the posts on using active admin with has_many through association but I'm not getting the desired results. Essentially I have 2 models "Conferences" & "Accounts". I need to assign multiple accounts to a conference and multiple conferences to an account. Wether I use HABTM or has_many through doesn't matter to me. I just need to be able to see a dropdown select option when I create a new conference and vice versa on accounts. Account Model class Account < ActiveRecord::Base attr_accessible :address, :city, :name, :phone, :state, :website, :zip has_many :contacts,

fields for images don't displays in active admin form

你离开我真会死。 提交于 2019-12-05 20:18:42
gem "formtastic", "~> 2.1.1" gem "activeadmin", "~> 0.4.2" gem "paperclip" fields for photos don't displays in active admin form app/views/admin/products/_form.html.erb ,but the same form in app/views/products/_form.html.erb works correctly in product's views > app/admin/products.erb ActiveAdmin.register Product do form :partial => "form" end app/views/admin/products/_form.html.erb <%= semantic_form_for [:admin , @product ], :html => { :multipart => true } do |f| %> <%= f.semantic_errors :name , :price , :description, :category_id %> <%= f.inputs :new_product do%> <%= f.input :name %> <%= f

Formtastic number field with decimal precision?

梦想的初衷 提交于 2019-12-05 11:37:57
Surely I'm missing something pretty obvious... I have a field that is decimal with precision 2, but Formtastic is displaying it with only a single decimal, unless the actual value has 2 places. What am I missing? Model: create_table "items", :force => true do |t| t.string "item_number" t.integer "buyer_id" t.integer "seller_id" t.string "description" t.decimal "sales_price", :precision => 10, :scale => 2, :default => 0.0 t.datetime "created_at" t.datetime "updated_at" end View %td= bought.input :sales_price, input_html: { class: 'span2'}, label: false Noting answer from below, which might not

How do you fix? formtastic :label_method is no longer available

女生的网名这么多〃 提交于 2019-12-05 04:21:49
Ok.. I'm new to ruby/rails. So to compensate for my weakness, my company had a guy come in to help me create the bones of our website. He put in formtastic :label_method, so we could change what fields are displayed in the DDLB. When I moved my project to a new box, I got this error. :label_method is no longer available What I'm wondering is.. what do I use in it's place? Xaca Xulu I think it might be: :member_label According to http://rubydoc.info/gems/formtastic/2.0.0/Formtastic/Helpers/InputHelper "(Symbol, Proc, Method) — Deprecated, renamed to :member_label" If that doesn't work could you

Formtastic with Mongoid embedded_in relations

ぃ、小莉子 提交于 2019-12-04 20:10:43
Is there any quick way to make a form for embeds_many-embedded_in relation? I have the following: class Team include Mongoid::Document field :name, :type => String embeds_many :players end class Player include Mongoid::Document embedded_in :team, :inverse_of => :players field :name, :type => String end I want to create a form for team with embedded editing for players. Seen https://github.com/bowsersenior/formtastic_with_mongoid_tutorial but "TODO" there. I wrote the formtastic_with_mongoid_tutorial and unfortunately I haven't figured out an easy way of dealing with embedded relations yet.

undefined method `has_many' for Formtastic

不羁岁月 提交于 2019-12-04 05:26:07
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.object.id.nil? app_f.input :_destroy, :as => :boolean, :label => "Supprimer l'utilisateur du lot" end