WYSIHAT 'resonds_to_parent "undefined method - Ruby on Rails
I just installed WysiHat successfully on my rails blog. It seems that the "add image" function is not working. It successfully lets me find and select an image from my desktop, but after hitting save, it doesn't do anything.
I also have Paperclip installed successfully and can attach images to records outside of a WYSIHAT form field.
Any ideas? (let me know if I need to post any code).
Also, WysiHat-engine uses facebox , not sure if this is relevant.
UPDATE : Added server log, it looks like paperclip is saving it, so not sure what is wrong yet.
Processing PostsController#update (for 127.0.0.1 at 2010-04-23 16:42:14) [PUT]
Parameters: {"commit"=>"Update", "post"=>{"body"=>"<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>", "title"=>"Rails Code for Search"}, "authenticity_token"=>"hndm6pxaPLfgnSMFAmLDGNo86mZG3XnlfJoNOI/P+O8=", "id"=>"105"}
Post Load (0.2ms) SELECT * FROM "posts" WHERE ("posts"."id" = 105)
Post Update (0.3ms) UPDATE "posts" SET "updated_at" = '2010-04-23 21:42:14', "body" = '<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>' WHERE "id" = 105
[paperclip] Saving attachments.
Redirected to http://localhost:3000/posts/105
Completed in 12ms (DB: 0) | 302 Found [http://localhost/posts/105]
UPDATE 2 I installed ImageMagic and now I am getting the following error.
Processing WysihatFilesController#index (for 127.0.0.1 at 2010-04-23 23:27:57) [GET]
Parameters: {"editor"=>"post_body_editor"}
WysihatFile Load (0.3ms) SELECT * FROM "wysihat_files"
Rendering wysihat_files/index
Rendered wysihat_files/_form (1.9ms)
Completed in 4ms (View: 3, DB: 0) | 200 OK [http://localhost/wysihat_files/?editor=post_body_editor]
Processing WysihatFilesController#create (for 127.0.0.1 at 2010-04-23 23:28:09) [POST]
Parameters: {"commit"=>"Save changes", "wysihat_file"=>{"file"=>#<File:/var/folders/F3/F3ovLEb1EMW4aZ5nsRvRlU+++TI/-Tmp-/RackMultipart20100423-43326-1mzeb3s-0>}, "authenticity_token"=>"IHF9Ghz6gYuAeNOUYhna+O0A4WrDbm4iha4Tsavu97o="}
NoMethodError (undefined method `responds_to_parent' for #<WysihatFilesController:0x10352a2c0>):
vendor/gems/wysihat-engine-0.1.12/app/controllers/wysihat_files_controller.rb:10:in `create'
Rendered rescues/_trace (25.2ms)
Rendered rescues/_request_and_response (0.3ms)
Rendering rescues/layout (internal_server_error)
Update 3 After reading the comment below, I think that maybe I am missing something in my Post model. Here is the code for the model.
class Post < ActiveRecord::Base
has_attached_file :photo
validates_presence_of :body, :title
has_many :comments, :dependent => :destroy
has_many :tags, :dependent => :destroy
has_many :ugtags, :dependent => :destroy
has_many :votes, :dependent => :destroy
belongs_to :user
after_create :self_vote
def self_vote
# I am assuming you have a user_id field in `posts` and `votes` table.
self.votes.create(:user => self.user)
end
cattr_reader :per_page
@@per_page = 10
end
a source to share
So it looks like it was responses_to_parent error. For some reason, my version of rails did not allow me to run the script / generate wysihat part of the installation. He said the permit was denied. I just ran gem install responses_to_parent and everything is fine. Wysihat is a little excited but will work for now.
a source to share
Try wysihat-engine. He uses a paper clip. And it works well in my application.
http://github.com/80beans/wysihat-engine
However, there are some problems. First, if you create a link, you cannot cancel it. There is a small tweak you need to do in the javascript file for the wysihat-engine. Will return to you with a patch. If you can figure it out by then .. great! :)
Btw. I don't think wysihat uses facebox. The wysihat engine does. Check the detach part in js file.
a source to share
Perhaps you need to install ImageMagick or some other image manipulation plugin. Anyway, follow Rails Bates' RailsCast and you can't go wrong: http://railscasts.com/episodes/134-paperclip
a source to share