Simple shape selection without model

I am using Simple Forms (w / Rails 3.2) and would like to create a form with highlighted.

For instance:

Email Format :Text and HTML :Text Only :HTML Only 

I do not want to create a model with associations for such a simple choice. How to add this to a form without a model?

+4
source share
3 answers
 f.input :email_format, :collection => ["Text and HTML", "Text Only", "HTML Only"], :prompt => "select email format" 

Contact

+5
source

The documentation in a simple form describes how to do this:

 <%= simple_form_for @foo do |f| %> ... <%= f.input :email_format, collection => ["Text", "HTML"] %> ... <% end %> 

This is not associated with associations. Or without a simple form:

 <%= select_tag :email_format, options_for_select(["Text", "HTML"]) %> 
+1
source

<%= f.input :format, collection: ["Text and HTML", "Text only", "HTML only"] %> If you work, if you are not going to store it in any model, I'm not sure what's the matter. I would add that your email model is a string.

0
source

Source: https://habr.com/ru/post/1487899/


All Articles