Macrow / rails_kindeditor

Kindeditor for Ruby on Rails
260 stars 108 forks source link

undefined method `kindeditor' for #<ActionView::Helpers::FormBuilder:0xbfe55c8> #70

Closed amandameng closed 7 years ago

amandameng commented 9 years ago

gem 'rails', '~> 3.0.10' gem 'rails_kindeditor', '~> 0.2.8' gem 'carrierwave', '~> 0.5.8'

view 6: <%= form_for @page, :url => page_path(@page.title) do |f| %> 7:

8: 9: <%= f.kindeditor :content, :simple_mode => true, :class => 'page_content' %> 10:
11:
12:

layout <%= javascript_include_tag 'kindeditor/kindeditor-min.js', 'kindeditor/kindeditor-init.js' %>

What did I miss?

amandameng commented 9 years ago

I end up with using plain JS code.

$(function() { var editor = KindEditor.create('textarea[class="page_content"]', { uploadJson: '/kindeditor/upload', allowFileManager: true, langType : 'en', resizeMode : 1, width : "1000px", height: "600px" });

})

Can you give me a clue why the helper method not working?

Macrow commented 9 years ago

Do you run the install generator?

  rails generate rails_kindeditor:install

and we don't need this anymore:

<%= javascript_include_tag 'kindeditor/kindeditor-min.js', 'kindeditor/kindeditor-init.js' %>

please follow the instuctions in README.md, then feedback the details.

amandameng commented 9 years ago

@Macrow I did run that, this copied javascripts to the public folder. I'm using 3.0.10, there's no assets. If don't include js like below, then how? <%= javascript_include_tag 'kindeditor/kindeditor-min.js', 'kindeditor/kindeditor-init.js' %>

Macrow commented 9 years ago

Please use rails_kindeditor v0.2.8 for Rails v3.0.x

https://github.com/Macrow/rails_kindeditor/tree/v0.2.8

Upgrade your rails is recommanded.

amandameng commented 9 years ago

gem 'rails_kindeditor', '~> 0.2.8'

It's the version I used.

Yeah, I think upgrade is great.