Prepopulate form with current_user name - Rails 4 + the_Comments -
Prepopulate form with current_user name - Rails 4 + the_Comments -
i want prepopulate comment form user logged in (through devise + twitter omniauth). got not thought how indice :title pre-populated 'current_user name'.
= form_for comment.new, remote: true, authenticity_token: true |f| .error_notifier{ style: "display:none" } %label= t('the_comments.form.title') %p= f.text_field :title %label= t('the_comments.form.contacts') %p= f.text_field :contacts %label= t('the_comments.form.content') %p= f.text_area :raw_content %p.trap - thecomments.config.empty_inputs.each |name| = text_field_tag name, nil, autocomplete: :off, tabindex: -1, id: nil = hidden_field_tag :tolerance_time, 0, id: nil, class: :tolerance_time = f.hidden_field :commentable_type, value: commentable.class = f.hidden_field :commentable_id, value: commentable.id = f.hidden_field :parent_id, class: :parent_id %p = f.submit t('the_comments.form.create'), class: :btn = t('the_comments.form.thank_you') i'm using the_comments gem commenting.
solved comments: value: current_user.name
you can seek below code
<%= f.text_field :title,value: current_user.name %> ruby-on-rails forms
Comments
Post a Comment