frankjmattia-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-30 05:17 UTC
cross linking controllers & polyporhism...
Alright, so this problem is two fold. One probably has a simple answer... And the other probably has a simple answer... Maybe not. 1) I have many different controllers... three of note would be ''order'', ''review'' & ''quote''. if im in viewing "/orders/list" i would like to generate a link to go to the corresponding review & quote. can a generic link_to be somehow cajoled into going to "/reviews/show/ 23432" where 23432 is the review_id of the order? problem 2) i can think of a million and one kludgy ways to do this but none of them seem to be good rails form... the same app has a model for inspection sheets. each order is assigned an inspection sheet and each inspection sheet has multiple validated fields which are created by whoever approves the order... for example... (and believe me, this is a gross oversimplification) order #23432 is for a custom made, standard square box. the boxes will be made by hand and each operator is going to check for 4 things. length, width and height of the box, limits specified at order time visual inspection heres where i think polymorphism might be a good solution, just dont know how to properly implement it... the length width and height are all numbers with a given range. when the inspected boxes are out of that range i''ll raise some kind of error or something... the visual inspection (and many other types of fields) are booleans... go/no go... good/no good... etc.. my original scheme went something like this... inspection_sheets: table containing all sheet_id''s and their corresponding orders. inspection_sheet_fields: a table to hold all the definition fields as users create them for new inspection sheets.. it would have a sheet_id, field_name...eg "length", and in the case of numerical input.. a max_value and a min_value... or in the case of booleans... just a good_value... lastly, inspection_sheet_rows: a table which would contain a sheet_id, field_id and a "measured_value" or some such.. to hold the physical value measured. now if you ask me, that last table, especially that last table - will get filled up in quite a hurry... but thats another bridge to cross at another time... not to mention the cost of re-evaluating the entire insepction sheet every time someone one wants to do "inspection_sheets/ show/23432"... im just looking for some suggestion on how to do this rubily... thanks for the input. -FJM --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Zach Inglis // LT3media
2007-May-30 05:23 UTC
Re: cross linking controllers & polyporhism...
1) link_to :controller => "order", :action => "show", :id => review.id (or whatever the id is) 2) Im confused about re-evaluating everytime someone show''s, evaluate on save, not on view? Also, on the validations. You may find this useful:http://feeds.feedburner.com/~r/RyansScraps/~3/120631326/what-s- new-in-edge-rails-validates_numericality_of-gets-pimped Cheers, Zach Inglis → Blog -- http://www.zachinglis.com → Company -- http://www.lt3media.com → Portfolio -- http://portfolio.zachinglis.com On May 30, 2007, at 12:17 AM, frankjmattia-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > Alright, so this problem is two fold. One probably has a simple > answer... > > And the other probably has a simple answer... > > Maybe not. > > 1) I have many different controllers... three of note would be > ''order'', ''review'' & ''quote''. > > if im in viewing "/orders/list" i would like to generate a link to go > to the corresponding review & quote. > > can a generic link_to be somehow cajoled into going to "/reviews/show/ > 23432" where 23432 is the review_id of the order? > > problem 2) i can think of a million and one kludgy ways to do this but > none of them seem to be good rails form... > > the same app has a model for inspection sheets. each order is assigned > an inspection sheet and each inspection sheet has multiple validated > fields which are created by whoever approves the order... for > example... (and believe me, this is a gross oversimplification) > > order #23432 is for a custom made, standard square box. > > the boxes will be made by hand and each operator is going to check for > 4 things. > > length, width and height of the box, limits specified at order time > visual inspection > > heres where i think polymorphism might be a good solution, just dont > know how to properly implement it... > > the length width and height are all numbers with a given range. when > the inspected boxes are out of that range i''ll raise some kind of > error or something... > > the visual inspection (and many other types of fields) are booleans... > go/no go... good/no good... etc.. > > my original scheme went something like this... > > inspection_sheets: table containing all sheet_id''s and their > corresponding orders. > > inspection_sheet_fields: a table to hold all the definition fields as > users create them for new inspection sheets.. it would have a > sheet_id, field_name...eg "length", and in the case of numerical > input.. a max_value and a min_value... or in the case of booleans... > just a good_value... > > lastly, > > inspection_sheet_rows: a table which would contain a sheet_id, > field_id and a "measured_value" or some such.. to hold the physical > value measured. > > now if you ask me, that last table, especially that last table - will > get filled up in quite a hurry... but thats another bridge to cross at > another time... not to mention the cost of re-evaluating the entire > insepction sheet every time someone one wants to do > "inspection_sheets/ > show/23432"... > > im just looking for some suggestion on how to do this rubily... > > thanks for the input. > -FJM > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
frankjmattia-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-30 05:42 UTC
Re: cross linking controllers & polyporhism...
Thanks for the help Zach, It occurred to me about 3 seconds after I posted it that :controller => was the one thing I didn''t try... Heh, I knew it had to be easy. And those additions to validates_numerically_of are certainly helpful. Now the fun part seems like figuring out how to store each fields necessary type of VNO and recalling it. It''s gonna be a long week. Here''s a question for you. The relationship between each fields "definition" field and its corresponding inspection field... would you say that the definition field HABTM inspections or just that each inspection has_one definition? Is there a large difference? On May 30, 1:23 am, Zach Inglis // LT3media <l...-w8tEHcFK2X5Wk0Htik3J/w@public.gmane.org> wrote:> 1) link_to :controller => "order", :action => "show", :id => > review.id (or whatever the id is) > > 2) Im confused about re-evaluating everytime someone show''s, evaluate > on save, not on view? Also, on the validations. You may find this > useful:http://feeds.feedburner.com/~r/RyansScraps/~3/120631326/what-s- > new-in-edge-rails-validates_numericality_of-gets-pimped > > Cheers, > Zach Inglis > → Blog --http://www.zachinglis.com > → Company --http://www.lt3media.com > → Portfolio --http://portfolio.zachinglis.com > > On May 30, 2007, at 12:17 AM, frankjmat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > > > Alright, so this problem is two fold. One probably has a simple > > answer... > > > And the other probably has a simple answer... > > > Maybe not. > > > 1) I have many different controllers... three of note would be > > ''order'', ''review'' & ''quote''. > > > if im in viewing "/orders/list" i would like to generate a link to go > > to the corresponding review & quote. > > > can a generic link_to be somehow cajoled into going to "/reviews/show/ > > 23432" where 23432 is the review_id of the order? > > > problem 2) i can think of a million and one kludgy ways to do this but > > none of them seem to be good rails form... > > > the same app has a model for inspection sheets. each order is assigned > > an inspection sheet and each inspection sheet has multiple validated > > fields which are created by whoever approves the order... for > > example... (and believe me, this is a gross oversimplification) > > > order #23432 is for a custom made, standard square box. > > > the boxes will be made by hand and each operator is going to check for > > 4 things. > > > length, width and height of the box, limits specified at order time > > visual inspection > > > heres where i think polymorphism might be a good solution, just dont > > know how to properly implement it... > > > the length width and height are all numbers with a given range. when > > the inspected boxes are out of that range i''ll raise some kind of > > error or something... > > > the visual inspection (and many other types of fields) are booleans... > > go/no go... good/no good... etc.. > > > my original scheme went something like this... > > > inspection_sheets: table containing all sheet_id''s and their > > corresponding orders. > > > inspection_sheet_fields: a table to hold all the definition fields as > > users create them for new inspection sheets.. it would have a > > sheet_id, field_name...eg "length", and in the case of numerical > > input.. a max_value and a min_value... or in the case of booleans... > > just a good_value... > > > lastly, > > > inspection_sheet_rows: a table which would contain a sheet_id, > > field_id and a "measured_value" or some such.. to hold the physical > > value measured. > > > now if you ask me, that last table, especially that last table - will > > get filled up in quite a hurry... but thats another bridge to cross at > > another time... not to mention the cost of re-evaluating the entire > > insepction sheet every time someone one wants to do > > "inspection_sheets/ > > show/23432"... > > > im just looking for some suggestion on how to do this rubily... > > > thanks for the input. > > -FJM--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---