Closed rasool-sb closed 9 years ago
I'm guessing you should leave out the permit-call in the controller, unless you're also using strong_parameters.
Sent from my iPhone
On 25 sep 2014, at 10:02 em, Rasool.SB notifications@github.com wrote:
Hi, Am getting error while uploading image using tinymce-rails-imageupload, the error shows in my rails server console is....
NoMethodError (undefined method
permit' for #<ActiveSupport::HashWithIndifferentAccess:0xb2c5410>): app/controllers/tinymce_assets_controller.rb:7:in
create'here are the details what i have configured as:
In my model: image.rib class Image < ActiveRecord::Base has_attached_file :file belongs_to :user belongs_to :event end
In my controller: tinymce_assets_controller.rb respond_to :json
def create geometry = Paperclip::Geometry.from_file(params[:file]) image = Image.create params.permit(:file, :alt, :hint)
render json: { image: { url: image.file.url, height: geometry.height.to_i, width: geometry.width.to_i } }, layout: false, content_type: "text/html" end
In my routes.rb post '/tinymce_assets' => 'tinymce_assets#create'
In data migration: create_images.rb class CreateImages < ActiveRecord::Migration def change create_table :images do |t| t.string :alt, default: "" t.string :hint, default: "" t.attachment :file t.timestamps end end end
And my environment details are: Ubuntu 12.04, ruby 1.9.3, rails 3.2.13, tinymce-rails 4.1.5 with tinymce-rails-imageupload.. and firefox 32. please let me know if you need some more details for verification.
Please help me! suggest me! guide me! point me! :) Thanks a LOT in Advance.
\ Reply to this email directly or view it on GitHub.
WooOOooW, Thanks for your very fast reply, amazed :), Yes, I tried this.., but after clicking on the insert button in "Insert picture from your computer" dialog box, the image not displays in the text_area box, it's just shoing border, I took the screenshot for verification..
I've made a small demo app, mentioned in the readme, both the live demo and the source. You could take a look at that.
I'm guessing there's something wrong with the URL returned from the controller. Check if it works outside of an editor maybe
Hi, Am getting error while uploading image using tinymce-rails-imageupload, the error shows in my rails server console is....
app/controllers/tinymce_assets_controller.rb:7:in `create'
here are the details what i have configured as:
In my model: image.rib class Image < ActiveRecord::Base has_attached_file :file belongs_to :user belongs_to :event end
In my controller: tinymce_assets_controller.rb respond_to :json
In my routes.rb post '/tinymce_assets' => 'tinymce_assets#create'
In data migration: create_images.rb class CreateImages < ActiveRecord::Migration def change create_table :images do |t| t.string :alt, default: "" t.string :hint, default: "" t.attachment :file t.timestamps end end end
And my environment details are: Ubuntu 12.04, ruby 1.9.3, rails 3.2.13, tinymce-rails 4.1.5 with tinymce-rails-imageupload.. and firefox 32. please let me know if you need some more details for verification.
Please help me! suggest me! guide me! point me! :) Thanks a LOT in Advance.