I’m trying out the new RESTful bits in Edge Rails, and am having a bit
of trouble wrapping my brain around certain things. For instance, say I
have a page that is separated into sections with tabs at the top. I want
to replace divs on the page with RJS.
Now typically before I’d have a method on the controller that rendered
an RJS template to accomplish this.
I’m not sure how to go about doing this with the new CRUD paradigm. I
can’t seem to use a regular link_to_remote tag as I get a routes error,
and I’m not sure what the syntax is to call a non CRUD method with
link_to_remote passing in an id param.
I’m not sure how to go about doing this with the new CRUD paradigm. I
can’t seem to use a regular link_to_remote tag as I get a routes error,
and I’m not sure what the syntax is to call a non CRUD method with
link_to_remote passing in an id param.
I’m only just figuring this out, so I’m not 100% sure on this.
Assuming you have a default route (‘:controller/:action/:id’) set up
in your routes.rb file, you should still be able to use link_to_remote
like you used to.
Additionally, you can use the :member option to add new named routes
that take an id:
You then render RJS in that action. As I said, I’ve only picked this
up last night really. Those examples should all work, but I’m not
positive that it’s the correct way to use them in the first place.
Pat
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.