Ruby on rails 令牌字段-堆栈级别太深

Ruby on rails 令牌字段-堆栈级别太深,ruby-on-rails,jquery-tokeninput,Ruby On Rails,Jquery Tokeninput,我尝试在帖子中添加标签已经有一段时间了。 我用它作为向导 Post表单具有嵌套的图像和标记。 标签在Ryan的剧集中作为作者处理 当创建新帖子时,我发现堆栈级别太深,出现错误 有什么想法吗 模型 class Post:destroy 验证:title,:presence=>true 验证:body,:presence=>true 验证:关键字,:presence=>true 验证:description,:presence=>true 扩展友好ID 友好的\u id:title,use::slu

我尝试在帖子中添加标签已经有一段时间了。 我用它作为向导

Post表单具有嵌套的图像和标记。 标签在Ryan的剧集中作为作者处理

当创建新帖子时,我发现堆栈级别太深,出现错误

有什么想法吗

模型

class Post:destroy
验证:title,:presence=>true
验证:body,:presence=>true
验证:关键字,:presence=>true
验证:description,:presence=>true
扩展友好ID
友好的\u id:title,use::sluged
接受:post_图像的_嵌套_属性,:allow_destroy=>true#,:reject_if=>lambda{a | a[:image]。blank?}
接受\u嵌套的\u属性\u for:tags,:allow\u destroy=>true
属性读取器:标签
def标记=(ID)
self.tags=ids.split(“,”)
结束
结束
形式

{:multipart=>true}do | f |%>





@post.tags.map(&:attributes).to_json%> 建筑商%>

日志

2012-03-29 15:43:57+0200时,127.0.0.1版开始发布“/posts” PostsController处理#创建为HTML 参数:{“utf8”=>“✓", "真实性\u令牌“=>”r/oWrpb4AOAwMrp+G6vOUmaQPFh32 NsabUa2h+O5KrY=“,”帖子“=>{”标题“=>“测试帖子”,“正文”=>“测试正文”,“关键字” =>“关键字”、“描述”=>“描述”、“标记”=>“1”、“发布图像\u属性” es“=>{”0“=>{”image“=>#,“'is_main”=>“1”,“\u dest” oy“=>”false“}}}”,commit“=>”Create Post“} 在24毫秒内完成500个内部服务器错误 SystemStackError(堆栈级别太深):
堆栈级别太深意味着您正在递归地更改属性。发生在这里:

def tags=(ids)
  self.tags = ids.split(",")
end
此方法需要使用不同的名称

<%= form_for @post, :html => {:multipart => true} do |f| %>
  <div class="field">
    <%= f.label :title %><br/>
    <%= f.text_field :title %>
  </div>
  <div class="field">
    <%= f.label :body %><br/>
    <%= f.text_area :body %>
  </div>
  <div class="field">
    <%= f.label :keywords %><br/>
    <%= f.text_field :keywords %>
  </div>
  <div class="field">
    <%= f.label :description %><br/>
    <%= f.text_field :description %>
  </div>

  <div class="field">
    <%= f.label :tags %><br/>
    <% if !@post.tags.blank? %>
      <%= f.text_field :tags, "data-pre" => @post.tags.map(&:attributes).to_json %>
    <% else %>
      <%= f.text_field :tags %>
    <% end %>
  </div>

  <%= f.fields_for :post_images do |builder| %>
    <%= render "post_image_fields", :f => builder %>
  <% end %>
  <p><%= link_to_add_fields "Add Image", f, :post_images %></p>

  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>
Started POST "/posts" for 127.0.0.1 at 2012-03-29 15:43:57 +0200
  Processing by PostsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"r/oWrpb4AOAwMrp+G6vOUmaQPFh32
NsabUa2h+O5KrY=", "post"=>{"title"=>"Test post", "body"=>"Test body", "keywords"
=>"key, words", "description"=>"description", "tags"=>"1", "post_images_attribut
es"=>{"0"=>{"image"=>#<ActionDispatch::Http::UploadedFile:0x392e410 @original_fi
lename="africa-web-l.jpg", @content_type="image/jpeg", @headers="Content-Disposi
tion: form-data; name=\"post[post_images_attributes][0][image]\"; filename=\"afr
ica-web-l.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:C:/Users/user
/AppData/Local/Temp/RackMultipart20120329-5772-dl0ix3>>, "is_main"=>"1", "_destr
oy"=>"false"}}}, "commit"=>"Create Post"}
Completed 500 Internal Server Error in 24ms

SystemStackError (stack level too deep):
def tags=(ids)
  self.tags = ids.split(",")
end