Custom Rails action and forms
I'm still trying to get my head around actions and routes. I more or less
understand how to user forms with the build-in controller actions like
create, show, etc. What I want to do for a demo app is imitate a school's
class schedule, where I have Courses and Students with a
has_and_belongs_to_many relationship.
I'm using Mongoid, and I can add students to a course and vice versa using
the console, but I can't figure out how to do it with a form. Would adding
students to a course even be a controller action, or can I write and call
a setter in the model somehow? If a controller action is better, what
would the route look like?
If anyone knows of an example that does something similar, I'd love to
examine it.
Thanks
No comments:
Post a Comment