Forum: Ruby on Rails Active Record Basics - Making it commentable

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jordan I. (Guest)
on 2006-06-01 04:02
hi everyone, I hope someone can help me out with some active record
basics?  I've been banging my head for the past 4 hours and I can't seem
to get it to work.

I am trying to add comments to a caption (just like how one adds a
comment to a post in a blog).  I seem to be able to read posts just fine
from the DB, however, I can't use the "recordComment" method in
captions_controller.rb.  Any ideas?  I suspect that it has something to
do with my recordComment method?  My code is posted in the below URL.

http://www.rafb.net/paste/results/piB0aG77.html

This the error that I get when I try to submit a comment:
Unknown action

No action responded to recordComment


Thanks in advance!
Ioana K. (Guest)
on 2006-06-01 12:03
(Received via mailing list)
try specifying also the controller....otherwise i have no idea

start_form_tag :controller => "captions", :action => 'recordComment',
:id => @caption
Jordan I. (Guest)
on 2006-06-01 12:14
Hi Ioana,

Thanks for the reply, however, I actually tried that and I get this
error:

Routing Error
Recognition failed for "/caption/recordComment/23"

If it helps at all, this is the URL that I get when I submit a comment:
http://localhost:3000/captions/recordComment/23


Thanks,
Jordan

Ioana K. wrote:
> try specifying also the controller....otherwise i have no idea
>
> start_form_tag :controller => "captions", :action => 'recordComment',
> :id => @caption
Ioana K. (Guest)
on 2006-06-01 12:43
(Received via mailing list)
Strange.In your routes.rb do u have this:
"map.connect':controller/:action/:id' "?...or i don't know take a
better look at
routes.rb...I think there's the key.
Jordan I. (Guest)
on 2006-06-01 13:13
Hi Ioana,

Thanks again for the reply.  But I seem to have that in my routes.rb
already:

 # You can have the root of your site routed by hooking up ''
  # -- just remember to delete public/index.html.
   map.connect '', :controller => "captions",  :action =>"list"

  # Allow downloading Web Service WSDL as a file with an extension
  # instead of a file named 'wsdl'
  map.connect ':controller/service.wsdl', :action => 'wsdl'

  # Install the default route as the lowest priority.
  map.connect ':controller/:action/:id'

Any other ideas?

Thanks again for taking the time to help me out!

Jordan


Ioana K. wrote:
> Strange.In your routes.rb do u have this:
> "map.connect':controller/:action/:id' "?...or i don't know take a
> better look at
> routes.rb...I think there's the key.
Ioana K. (Guest)
on 2006-06-01 13:24
(Received via mailing list)
Give another name to your method :-D
Sorry no idea. It's beyond me.
Jordan I. (Guest)
on 2006-06-01 13:28
Ha ya that was another idea I had so I changed it from 'def comment' to
'def recordComment'....didn't work :(

Well thanks for trying though.  I hope someone else can help me out!
Thanks again!

Ioana K. wrote:
> Give another name to your method :-D
> Sorry no idea. It's beyond me.
Josh S. (Guest)
on 2006-06-01 20:12
Jordan I. wrote:
> Routing Error
> Recognition failed for "/caption/recordComment/23"
>
> If it helps at all, this is the URL that I get when I submit a comment:
> http://localhost:3000/captions/recordComment/23

Your URL should have a plural "captions" not singular "caption" in the
controller piece, just like the generated URL.

--
Josh S.
http://blog.hasmanythrough.com
This topic is locked and can not be replied to.