Hey guys,
Before I start off, I'm a Rails newbie, so if there is an obvious
solution to this problem, let me know!
I have a simple, blog-like Rails project. In the routes, I have a users
resource with a nested posts resource. Now, this is all fine and dandy
if everything is generated with Ruby.
Now, if I add an Ajax layer over this, things seem to complicate quite a
bit. Say, if I want to perform some kind of request using jQuery, I need
to be able to know the appropriate path to perform this request on (ex,
users/1/post/new), but this requires me to generate this path
dynamically in the Rails script. If I have couple hundred users, this
would mean that each one of these users would have to have these paths
dynamically generated. The issue is, this is not so good when it comes
to bandwidth, download times, and so forth.
And so I thought, why not split off the posts resource and NOT make it
nested? That way, I could have paths like 'post/new', and collect the
user information via the request. This makes the project extremely
unclean, however. It's just not... pretty.
How can I handle this issue? What is the best way to approach it?
Thanks much!
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment