2013-08-02 2 views
2

wysihtml5 편집기 (부트 스트랩 용)에 문제가 있습니다. 단지 세 줄만 들고 다른 줄은 없앴습니다. 내가 편집자에게 10 줄을 줄 때. 단지 세 줄 밖에 걸리지 않습니다. 그래서 세 줄만 저장되었습니다. 감안wysihtml5가 제대로 작동하지 않습니다

(_form.html.erb)

<%= simple_form_for @announcement, :html => { :class => 'form-horizontal' } do |f| %> 
    <%= f.input :name %><br/> 
    <%= f.input :description, as: 'text', :input_html =>{:rows => '25', :cols => '25', :class => 'input wysihtml5' } %> 
    <div class="input string optional"><label class="string optional control-label" for="school_school_name">Upload Logo</label> 
    <%= f.fields_for :pictures do |i| %> 
     <%= i.file_field :avatar %> 
    <% end %></div><br/> 
    <div class="form-actions"> 
    <%= f.button :submit, :class => 'btn-primary' %> 
    <%= link_to t('.cancel', :default => t("helpers.links.cancel")), 
       announcements_path, :class => 'btn' %> 
    </div> 
<% end %> 

모델 :

include ActionView::Helpers::SanitizeHelper 
class Announcement < ActiveRecord::Base 
    attr_accessible :description, :name, :pictures_attributes 


    #association 
    has_many :pictures, :as => :imageable 
    accepts_nested_attributes_for :pictures, allow_destroy: :true 


    #before_save :strip_html 

end 

컨트롤러 :

class AnnouncementsController < ApplicationController 
    # GET /announcements 
    # GET /announcements.json 
    def index 
    @announcements = Announcement.all 

    respond_to do |format| 
     format.html # index.html.erb 
     format.json { render json: @announcements } 
    end 
    end 

    # GET /announcements/1 
    # GET /announcements/1.json 
    def show 
    @announcement = Announcement.find(params[:id]) 

    respond_to do |format| 
     format.html # show.html.erb 
     format.json { render json: @announcement } 
    end 
    end 

    # GET /announcements/new 
    # GET /announcements/new.json 
    def new 
    @announcement = Announcement.new 
    @announcement.pictures.build 

    respond_to do |format| 
     format.html # new.html.erb 
     format.json { render json: @announcement } 
    end 
    end 

    # GET /announcements/1/edit 
    def edit 
    @announcement = Announcement.find(params[:id]) 
    end 

    # POST /announcements 
    # POST /announcements.json 
    def create 
    @announcement = Announcement.new(params[:announcement]) 

    respond_to do |format| 
     if @announcement.save 
     format.html { redirect_to @announcement, notice: 'Announcement was successfully created.' } 
     format.json { render json: @announcement, status: :created, location: @announcement } 
     else 
     format.html { render action: "new" } 
     format.json { render json: @announcement.errors, status: :unprocessable_entity } 
     end 
    end 
    end 

    # PUT /announcements/1 
    # PUT /announcements/1.json 
    def update 
    @announcement = Announcement.find(params[:id]) 

    respond_to do |format| 
     if @announcement.update_attributes(params[:announcement]) 
     format.html { redirect_to @announcement, notice: 'Announcement was successfully updated.' } 
     format.json { head :no_content } 
     else 
     format.html { render action: "edit" } 
     format.json { render json: @announcement.errors, status: :unprocessable_entity } 
     end 
    end 
    end 

    # DELETE /announcements/1 
    # DELETE /announcements/1.json 
    def destroy 
    @announcement = Announcement.find(params[:id]) 
    @announcement.destroy 

    respond_to do |format| 
     format.html { redirect_to announcements_url } 
     format.json { head :no_content } 
    end 
    end 
end 

JS 스크립트 wysihtml5를 실행 :

+0

값이 올바른지 확인하려면 웹 서버를 통과하는 param [: description]을 살펴보십시오. – Nich

답변

0

귀하의 속성이 데이터베이스에 잘못된 유형으로 설정되어 있기 때문에 제 추측입니다. 텍스트가 아닌 문자열로 사용하기 때문에 자동으로 자릅니다.

관련 문제