uses the debate title length in the debates form

This commit is contained in:
kikito
2015-08-06 14:01:48 +02:00
parent 6b58fd64bb
commit 5c141e36ab
2 changed files with 4 additions and 1 deletions

View File

@@ -1,5 +1,8 @@
require 'numeric'
class Debate < ActiveRecord::Base
TITLE_LENGTH = Debate.columns.find{|c| c.name == 'title'}.limit
acts_as_votable
acts_as_commentable
acts_as_taggable

View File

@@ -12,7 +12,7 @@
<p><strong><%= t("debates.form.debate_title") %></strong></p>
<p><%= t("debates.form.title_instructions") %></p>
<%= f.text_field :title %>
<%= f.text_field :title, maxlength: Debate::TITLE_LENGTH %>
<br/>
<p><strong><%= t("debates.form.debate_text") %></strong></p>