nested-attributes

Rails 4.1 Nested Attributes and Fields For Getting Unpermitted Parameters and Not Saving

笑着哭i 提交于 2019-12-24 00:55:44
问题 Research: Rails 4.0 beta, fields_for not accepting pluralized model_name in one-to-many association, Rails 4 Nested Attributes with fields_for Don't Save to Database First, let's get the most common problem out of the way: incorrectly named attributes parameters for strong parameters. Mine is correctly plural. class AdultsController < ApplicationController ... def update authorize @user respond_to do |format| if @user.update_attributes(user_params) format.html { redirect_to unit_adult_path(

Rails 4 Nested Attributes with fields_for Don't Save to Database

不羁的心 提交于 2019-12-24 00:04:22
问题 I want to create records on two different tables (venue and parking) via one form using accepts_nested_attributes_for. I want a user to be able to create a new venue, and also specify the parking options available to that venue via checkboxes. When I submit the form, the record for the containing model (venue) is created, but nothing happens with the nested model (parking). When I check the response from the server, I see that I'm encountering "Unpermitted parameters: parking_attributes,"

Nested attributes not showing up in simple form

拥有回忆 提交于 2019-12-23 10:09:02
问题 Given the following: Models class Location < ActiveRecord::Base has_many :games end class Game < ActiveRecord::Base validates_presence_of :sport_type has_one :location accepts_nested_attributes_for :location end Controller def new @game = Game.new end View (form) <%= simple_form_for @game do |f| %> <%= f.input :sport_type %> <%= f.input :description %> <%= f.simple_fields_for :location do |location_form| %> <%= location_form.input :city %> <% end %> <%= f.button :submit %> <% end %> Why the

accepts_nested_attributes not saving any changes

北慕城南 提交于 2019-12-23 05:35:08
问题 Maybe I'm missing something obvious (hopefully), but I'm encountering a weird problem saving records in a nested form. It's a pretty basic setup, with a minor complication in that my LineItem model is a two-word relationship (:line_items). However, I've followed Rails guidelines and it seems to be working OK. My fixtures are creating the proper relationships between line_items and invoices, and everything is showing up properly in my views, but I can't get any line_item records to save

Swig error with Nested enums in C++

会有一股神秘感。 提交于 2019-12-23 03:37:13
问题 I have a class similar to the following. It has a nested enum OptionTag. class MediaPacket { public: struct RtcpAppName { char mName[RTCP_APPNAME_LENGTH]; }; enum OptionTag { RESERVED = 0, PROFILE = 1, LATENCY = 2, PKTLOSS = 3, JITTER = 4, LEGACYMIX = 5, LASTTAG = 255 }; .... .... list<OptionTag> GetOptions(unsigned int ssrc) const; }; For this I created a swig interface as follows %module mediaopts_packet %include "stdint.i" //Redefining nested structure in swig struct RtcpAppName { char

Rails Forms for Private Messaging

徘徊边缘 提交于 2019-12-23 03:36:13
问题 I am trying to create a private messaging feature on my app between two users and I am running into trouble here First, here's Schema.rb create_table "conversations", :force => true do |t| t.string "conversation_subject end create_table "messages", :force => true do |t| t.string "content" t.integer "user_id" t.integer "conversation_id" end create_table "participants", :force => true do |t| t.integer "conversation_id" t.integer "user_id" end conversations has_many :messages, :participants

nested model attributes + wicked wizard form not working

你说的曾经没有我的故事 提交于 2019-12-23 02:17:26
问题 I am making an app based on the railscast tutorial 346(Wicked gem) and 196(nested model). I am trying to combine these 2 together and I am stuck because strong param attributes are not saving. So my app goes like this: I have a user, work, and education model. user.rb: has_many :educations, dependent: :destroy has_many :works, dependent: :destroy accepts_nested_attributes_for :educations, :works education.rb belongs_to :user work.rb belongs_to :user And then i generated the wicked wizard

Issue updating class in combobox from nested form

眉间皱痕 提交于 2019-12-22 01:31:16
问题 I created a combobox that show suppliers so when supplier is selected will update a div showing purchases , after showing purchases will be in combobox but in a nested form so when I select a purchase will show me the amount of the purchase selected. The problem is that when I select a purchase only works in the first line and when I select another combobox line show the amount of the first combobox selected. Here my tables suppliers |id| |name| 1 Supplier A 2 Supplier B shopping_documents

RecordNotFound with accepts_nested_attributes_for and belongs_to

社会主义新天地 提交于 2019-12-21 17:21:14
问题 I get ActiveRecord::RecordNotFound: Couldn't find Client with ID=3 for Order with ID= when trying to submit an Order form for an existing client. This happens through the form or the console by typing: Order.new(:client_attributes => { :id => 3 }) payment_form.html.erb : <%= semantic_form_for @order, :url => checkout_purchase_url(:secure => true) do |f| %> <%= f.inputs "Personal Information" do %> <%= f.semantic_fields_for :client do |ff| %> <%= ff.input :first_name %> <%= ff.input :last_name

Fields_for disappear when adding accepts_nested_attributes_for

廉价感情. 提交于 2019-12-21 03:53:08
问题 I'm doing a nested form in Rails 3.2.5, but when I add the accepts_nested_attributes_for my fields_for disappear (they just stop showing in my form). This are my models: class Product < ActiveRecord::Base attr_accessible :title, :description, :variants_attributes has_many :variants accepts_nested_attributes_for :variants validates :title, presence: true end My second model is class Variant < ActiveRecord::Base belongs_to :product attr_accessible :price, :sku, :weight, :inventory_quantity,