简体   繁体   English

如何在Ruby on Rails中从控制器映射数据

[英]How can i map the data from controller in Ruby on Rails

in create page view , 在创建页面视图中,

I have a radio button like this, 我有一个单选按钮,

<%=radio_button_tag(:repeat, "1")%><%=f.label("None")%>
<%=radio_button_tag(:repeat, "2")%><%=f.label("Start Now")%>
<%=radio_button_tag(:repeat, "3")%><%=f.label("Daily")%>
<%=radio_button_tag(:repeat, "4")%><%=f.label("Weekly")%>
<%=radio_button_tag(:repeat, "5")%><%=f.label("Monthly")%>

and if i submit, it sends like this. 如果我提交,它会像这样发送。

Parameters: {"utf8"=>"✓", "authenticity_token"=>"jJP/GZxllRLV2q/gENb0raCVhKPlASPdc+f6hqP23dE=", "appointment"
=>{"appointmentname"=>"test for repeat daily first", "description"=>"daily "}, "repeat"=>"3", "start_date"=>"20
14-03-13", "start_time"=>"16:00", "end_time"=>"17:00", "repeat_time"=>"19", "roomType"=>"1", "bb_state_id"=>"10
7", "jNameTimeZone"=>"Etc/GMT", "invited_radio_btn"=>"1", "numberOfParticipants"=>"1", "moderatorId"=>"1", "att
endee_list"=>[{"id"=>"1", "email"=>"hyunjae.park@access-company.com", "firstname"=>"hyunjae", "lastname"=>"park
"}]}

as you can see, the parameter "repeat"=>"3" is there. 如您所见,参数"repeat"=>"3"在那里。

ok, i saved this to the database. 好的,我将其保存到数据库中。

now, i want to edit this page. 现在,我要编辑此页面。

from the controller it sends the param like this. 从控制器发送这样的参数。

@repeat

If i print this with logger.debug. 如果我用logger.debug打印。 it shows what i have chosen(1~5 value) 它显示了我选择的值(1〜5值)

now, with this parameter 现在,使用此参数

in the view, i have to map the radio_button which has been chosen when the room was created. 在视图中,我必须映射在创建房间时选择的radio_button。

But it doesn't matches it :( 但它不匹配:(

What is my problem in here??? 我在这里有什么问题???

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Ruby on Rails中,如何将控制器中的所有动作映射到root? - In Ruby on Rails, how can I map all actions in a controller to root? 如何限制我从Ruby on Rails中的控制器传递的数据 - How to limit what data I pass in from the controller in Ruby on Rails 如何检查Ruby on Rails控制器中是否有查询字符串? - How can I check if there is a query string from a Ruby on Rails controller? 如何从视图中修改控制器中的变量(红宝石在轨道上) - How can I modify a variable in the controller from the view (ruby on rails) 如何将数据从核心数据迁移到Ruby On Rails? - How can I migrate data from Core Data to Ruby On Rails? 如何从外部从Ruby on Rails应用程序访问数据? - How can I access data from a Ruby on Rails application externally? 如何在Rails的“编辑”表单中映射来自关联的数据? - How can I map data from associations in “Edit” Forms in Rails? Ruby on Rails -in coffeescript如何访问控制器返回的数据 - Ruby on Rails -in coffeescript how do I access data returned from controller 如何从 Ruby on Rails 的控制台调用控制器/视图帮助器方法? - How can I call controller/view helper methods from the console in Ruby on Rails? 如何在 Rails 上的 Ruby 中将两个参数从 controller 传递到 model? - How can I pass two params from controller to model in Ruby on Rails?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM