reform

How to use Reform to prepopulate for featured objects?

廉价感情. 提交于 2020-01-12 08:50:55
问题 When a user clicks, for example, "Take a Picture" how can we prepopulate the create.html.erb form with attributes specifically set for that featured challenge, like do for 12 days and do on Tue, Thu ? I am using the reform gem. #challenges_controller def new @challenge = Challenge.new respond_modal_with @challenge, location: root_path end #challenges/new.html.erb <%= simple_form_for(@challenge, html: { data: { modal: true } }) do |f| %> <%= f.text_field :action, placeholder: 'Enter a Custom

How to use Reform to prepopulate for featured objects?

一曲冷凌霜 提交于 2019-12-03 17:36:33
When a user clicks, for example, "Take a Picture" how can we prepopulate the create.html.erb form with attributes specifically set for that featured challenge, like do for 12 days and do on Tue, Thu ? I am using the reform gem . #challenges_controller def new @challenge = Challenge.new respond_modal_with @challenge, location: root_path end #challenges/new.html.erb <%= simple_form_for(@challenge, html: { data: { modal: true } }) do |f| %> <%= f.text_field :action, placeholder: 'Enter a Custom Challenge' %><br> Or choose a featured challenge: <%= f.collection_radio_buttons :action, [['Run a Mile

Rails form object with reform-rails with collections not working or validating

馋奶兔 提交于 2019-12-01 02:35:22
问题 I am using the reform-rails gem In order to utilize a form object in my rails project. I realize a form object is probably overkill for the example code I use below, but it is for demonstration purposes. In the form I am creating a user , and associated to that user record are two user_emails . # models/user.rb class User < ApplicationRecord has_many :user_emails end # models/user_email.rb class UserEmail < ApplicationRecord belongs_to :user end Notice that I am not using accepts_nested