Update Array in rails view form

조회수 24회
읽지 않은 첫 메시지로 건너뛰기

Vlad Panainte

읽지 않음,
2014. 12. 30. 오전 5:52:1814. 12. 30.
받는사람 rubyonra...@googlegroups.com
Hi guys,

I need some help with updating an array using rails view form .

In controller 

def foo_params
    params.require(:foo).permit(:value,:rvalue)
  end

where rvalue is an array. I've tried :rvalue=>[] but no luck


In form I have 
 <%= form_for :foo, url: foo_path(@foo.foo_value, @foo), method: :put, html: {class: 'uk-form'} do |builder| %>
.....
<%= builder.label "rvalue", "Value" %>
<%= builder.text_field "rvalue" , class: "uk-width-1-1" %>

Can you please help?

Thanks

Frederick Cheung

읽지 않음,
2014. 12. 30. 오전 7:37:3914. 12. 30.
받는사람 rubyonra...@googlegroups.com


On Tuesday, December 30, 2014 10:52:18 AM UTC, Vlad Panainte wrote:
Hi guys,

I need some help with updating an array using rails view form .

In controller 

def foo_params
    params.require(:foo).permit(:value,:rvalue)
  end

where rvalue is an array. I've tried :rvalue=>[] but no luck


What's the problem? Is strong parameters not permitting the value or something else?

Fred

Hassan Schroeder

읽지 않음,
2014. 12. 30. 오전 11:57:3814. 12. 30.
받는사람 rubyonrails-talk
On Tue, Dec 30, 2014 at 2:52 AM, Vlad Panainte <vlad.p...@gmail.com> wrote:

> def foo_params
> params.require(:foo).permit(:value,:rvalue)
> end
>
> where rvalue is an array. I've tried :rvalue=>[] but no luck

> <%= builder.text_field "rvalue" , class: "uk-width-1-1" %>

? Your "rvalue" param is going to be a string.

I don't understand why you expect it to be an array.

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
전체답장
작성자에게 답글
전달
새 메시지 0개