Home >

nested attributes

  • Before validation on nested modelJanuary 9

    I have a nested model items and I am trying to multiply two columns together cost and quantity to set the last column price. I need to set the column price before the form is saved and i need to also validate the model. The before_validation call bac

  • Uploading multiple files using nested attributes and carrierwave getmDecember 5

    I am doing multiple file upload using nested fields and Carrierwave gem. Here is my set up: <%= form_for @medical_situation, url: create_medical_situation_patients_path(patient:@patient) do |f| %> <%= f.fields_for :lab_tests do |lab_test| %> &

  • Implement order pages with railsFebruary 15

    I wanna implement a order page, but it's so hard... The system is in portugues, for others reasons, sorry about this. My view: conta/pedidos/index.html.erb <h3>Meus pedidos</h3> <table> <thead> <th>#</th> <th>Data

  • Rails 4: Strong parameters + nested attributes + multiple selectFebruary 13

    I have a model called TaxCategory, that has_many :tax_rates and accepts_nested_attributes_for :tax_rates, reject_if: :all_blank, allow_destroy: true. TaxRates itself is a model, which, amongst other things, has_and_belongs_to_many :countries. These r

  • nested form associated model getting autosavedFebruary 10

    My associated model gets autosaved. I would like this to happen only when those fields contains any values. Obviously reject_if is the way to go for this but I cannot get it to work. I've tried :new_record? together with passing in the Proc. But I su

  • Problems with *_ids method in ActiveRecordFebruary 9

    I'm using rails 4.2.5 with postgresql. I have a model like this: class PlatformLink < ActiveRecord::Base belongs_to :platform belongs_to :download_link end class Platform < ActiveRecord::Base has_many :platform_links has_many :download_links, throug

  • Rails Polymorphic associations coupled with accepts_nested_attributes_forFebruary 8

    I've been trying to set up a form that allows you to add records that relate to polymorphic models. The models that they are connected to are significantly different in schema, so I was wondering how this would work with strong parameters. For the pu

  • ActionController "No explicit conversion of Symbol into Integer" for new record in Rails 4.2.1

    ActionController "No explicit conversion of Symbol into Integer" for new record in Rails 4.2.1February 5

    I'm trying to create @booking and @booking.build_passenger in form_for with nested attributes in Rails 4.2.1 The error I get: As you see in the console at the bottom of the image: 1. params.require(:booking) returns a Hash-like params for @booking 2.

  • Rails 4: Complex forms and nested attributesFebruary 3

    I have a Rails 4 app where I have two related controllers, potential_client and location. I am trying to enable to creation of potential clients through the location controller. I believe there is something wrong with my form because it gets submitte

  • Form with nested attributes and has_many :through relationship create new record instead of using existing oneFebruary 3

    What I try to do is a simple form for Plate where you can choose which Ingredients you want. The number and name of Ingredients may vary by day. Every time a new Plate is created, it created 4 new Choices with plate_id and ingredient_id and a boolean

  • Dynamically generated field in nested form added twice RailsFebruary 2

    I have two models, the first is grants the second is specs. Specs has two fields ineligibility and eligibility and is nested into grants. I have mostly everything set up fine but I need help modifying the JQuery because every time I click "add an ine

  • Rails 4 nested attributes not adding record to current project, instead it's adding new project records

    Rails 4 nested attributes not adding record to current project, instead it's adding new project recordsFebruary 1

    And the records from Project Updates are being uploaded to the new Project record. I'm trying to use cocoon gem for nested attributes, but its adding new project record, and not just adding new project updates within the same project I have the form

  • Rails nested Attributes with Devise (Signup form)February 1

    I am using Rails 4.2 and Devise 3.5 and trying to get nested attributes working (i've gone through multiple posts and still can't seem to fix it.) Effectively I have a leads model and a bookings model (where a lead can have multiple bookings). Models

  • Rails nested models and virtual attribute initializationJanuary 27

    I have a problem understanding how are attributes "sent" to nested model(s), and if is possible to do this for model with virtual attrubute too. I have three models: class User < ActiveRecord::Base ... has_and_belongs_to_many :clearancegoods

  • nested XML parsing with sax and PythonJanuary 26

    I'm looking for a solution to be able to parse a non-standard encoded XML file which has elements (not only content) encoded as well (simplified Chinese). I have managed to build a ContentHandler using sax (and python) which works quite well, here's

  • How to properly route a nested resources destroy action?January 24

    So I have a nested resource Items belonging to invoices and I am trying to destroy Items by deleting them when Invoices are created/edited. I can delete records but when I do so the record gets deleted form the db but page does not refresh or go anyw

  • Edit action with nested form always adds new form fields under form recordsJanuary 21

    I cant figure out what is happening with this nested form. When I create a new invoice the form works fine, but when I go to the Invoice edit action I see the saved records and a new empty nested form underneath. How do I stop this from happening? My

  • How to use nested_attributes when processing JSON?January 16

    I'm trying to write an update method that processes JSON. The JSON looks like this: { "organization": { "id": 1, "nodes": [ { "id": 1, "title": "Hello", "description": "My descript

  • Nested attributes not being inserted into tableJanuary 16

    I have a situation where one of my nested fields is being passed to parameters but is not being inserted into the table. My model Company has_one :incorporation. Incorporation has, right now anyway, one field, nested into the Company form as follows

  • Rails accepts_nested_attributes_for associated models not createdJanuary 15

    I have two models (Company and User) that have a belongs_to/has_many relationship. class Company < ActiveRecord::Base attr_accessor :users_attributes has_many :users accepts_nested_attributes_for :users, allow_destroy: true end class User < ActiveRe

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.436 s.