rails text_field_tag


Creates a standard text field; use these text fields to input smaller chunks of text like a username or a search query.

Options

  • :disabled – If set to true, the user will not be able to use this input.
  • :size – The number of visible characters that will fit in the input.
  • :maxlength – The maximum number of characters that the browser will allow the user to enter.
  • :placeholder – The text contained in the field by default which is removed when the field receives focus.
  • Any other key creates standard HTML attributes for the tag.

text_field_tag is from ActionView::Helpers::FormTagHelper, which states :

Provides a number of methods for creating form tags that doesn’t rely on an Active Record object assigned to the template like FormHelper does. Instead, you provide the names and values manually.

Since this is a helper that does not rely on an active record object, you cannot call this method for the “f” object. It’s a a helper method that should be called like this :

<%= text_field_tag "whatever you want to write" %> 

What is the difference between embedded and referenced


Relations are associations between one model and another in the domain and in the database. 

Embedded:

Embedded relations describe documents who are stored inside other documents in the database. Embedded relations are associations between one or many objects where the child object is embedded within the parent in the same document in the database

Referenced:

Referenced relations describe documents that reference documents in another collection by storing data (usually an id) about the other document in itself. In other word Referenced relations are associations between documents that reside in separate collections.