> Stuff has_many my_stuff So in the model of "Stuff" declare that Stuff has_many my_stuff. The goal of this is to reuse the data in the Stuff table based on a user ID, not set up a separate table, yes?
> Then any individual Stuff will expose .my_stuff method. You will have > to create the CRUD operations for the MyStuff, that will contain > stuff_id field for the association. I create the CRUD for "MyStuff" w/ the user ID & stuff ID (versus just the stuff ID in the "Stuff" CRUDs). Do I need a new controller for "MyStuff"? On Jan 15, 1:22 am, Eduard Martini <[email protected]> wrote: > Stuff has_many my_stuff > > Then any individual Stuff will expose .my_stuff method. You will have > to create the CRUD operations for the MyStuff, that will contain > stuff_id field for the association. > > On Jan 15, 8:10 am, Souschef <[email protected]> wrote: > > > I'm new to rails & am building out an application to learn from. From > > a conceptual perspective, how would I go about working with a subset > > of data? For example, say I have an application with basic CRUD > > operations on "Stuff". I've implemented the restful_authentication > > plugin and am now struggling with how would I deal with setting up > > CRUD for "MyStuff" (i.e. Stuff associated with a particular user ID). > > What's the best approach? Any good examples/tutorials out there? > > > Following are thoughts I'm considering: > > > - Recreate the controller & views for "Stuff", but just using the > > subset of data associated with the user's ID. > > - as a subset to this, I see the "Stuff" controller is "class > > StuffController < ApplicationController". Do I want to set > > up something like "class MyStuffController < Stuff > > Controller". Is this possible? > > > - I've read on various the web pages about filtering, but not sure I > > understand it fully. Can this be used? > > Really I'm just working with a subset of "Stuff", and I'd think I > > should be able to re-use the controller, views, etc. > > by just passing it a different data set, but then maybe this is a > > naive perspective. > > > - Is this an inheritance concept? > > > Thanks in advance for your guidance! > >
-- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

