A
A
Anatoly Chernyshev2019-05-30 18:53:52
Ruby on Rails
Anatoly Chernyshev, 2019-05-30 18:53:52

How to add an array of elements to rails 5 white sheet?

There is such a structure

manual_input: [
    {
      type: 'Акции',
      currency: 'USD',
      symbol: 'CSCO',
      date: '2018-01-23',
      amount: '13',
      price: '14.23'
      commission: '-1.2312211'
    },..
  ]

How can I validate internal parameters if I do not know the number of elements in the array? I have tried similar design
params.require([]).permit(:type, :currency, :symbol, :date, :amount, :price, :commission)
#так же пробовал
params.permit([{:type, :currency, :symbol, :date, :amount, :price, :commission}])

But in both cases it swears at unresolved parameters

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timokins, 2017-06-17
@E-em

The error is in this line: it is not necessary to refer to the model abstractly, but through the instance obtained earlier: i.e.
(user.checkPassword(password));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question