Home Ruby form helper get sucked with older value
Reply: 0

# Ruby form helper get sucked with older value

user1277
1#
user1277 Published in July 20, 2018, 1:12 am
 I got blocked while trying to get the right value after value overwriting before submitting the form from a CircleCreateService From my Circle create Service I have this: def step_trigger(case_action) case case_action when 'User never create a circle' 'ncreate' when 'User has created once' 'onecreate' when 'User has created many' 'mcreated' end end  And this is what I saved into my database. So my problem is, from my form, when I am trying to edit the Circle, how can I get the old value from the db using a helper method to render corresponding option based on the retrieved data from my db? This is my helper method: def get_old_cirle_option(options) case options when 'ncreate' 'User never create a circle' when 'oncecreate' 'User has created once' when 'mcreated' 'User has created many' end end  And in my form I use this: <%= select_tag :c_options, options_from_collection_for_select( get_old_cirle_option(@circe.state)), class: "form-control" %>  the it says: undefined methodmap' for nil:NilClass Did you mean? tap`
 You need to login account before you can post.
Processed in 0.248191 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO