Active Record Basics - Making it commentable

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!

try specifying also the controller…otherwise i have no idea

start_form_tag :controller => “captions”, :action => ‘recordComment’,
:id => @caption

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

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.

Give another name to your method :smiley:
Sorry no idea. It’s beyond me.

Ha ya that was another idea I had so I changed it from ‘def comment’ to
‘def recordComment’…didn’t work :frowning:

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

Ioana K. wrote:

Give another name to your method :smiley:
Sorry no idea. It’s beyond me.

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. 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