Hey, I''m not sure how complex this really is, but i hope it isn''t too difficult for you guys to explain here My question is, is there a way to intercept a Submit action (for a scaffold, etc) of a form, and take that submit action and present it to an ADMIN user, where he/she can either finish submitting the form, or ignore the request? Kind of a like a confirmation system.. Hopefully you guys can help me out, I''m not that good at ruby on rails, but hopefully ill get better :) Thanks for your help! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 6, 11:08 pm, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey, > > I''m not sure how complex this really is, but i hope it isn''t too > difficult for you guys to explain here > > My question is, is there a way to intercept a Submit action (for a > scaffold, etc) of a form, and take that submit action and present it > to an ADMIN user, where he/she can either finish submitting the form, > or ignore the request? >Well it should be relatively simple in the update or create actions to only go through with the change if the user is an admin. If the user isn''t an admin then store the submitted parameters. One way of viewing might be to say that users never submit to the update or create actions - their forms only ever create change request objects which can then be reviewed by admins. Fred> Kind of a like a confirmation system.. > > Hopefully you guys can help me out, I''m not that good at ruby on > rails, but hopefully ill get better :) > > Thanks for your help!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Hmm great explanation. I''m not that great at ror, so could u briefly show me some sample Create/form code that stores the fields, and transfers them to an admin? Do i need to create a whole new database for pending requests? Thanks On Apr 6, 6:24 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Apr 6, 11:08 pm, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey, > > > I''m not sure how complex this really is, but i hope it isn''t too > > difficult for you guys to explain here > > > My question is, is there a way to intercept a Submit action (for a > > scaffold, etc) of a form, and take that submit action and present it > > to an ADMIN user, where he/she can either finish submitting the form, > > or ignore the request? > > Well it should be relatively simple in the update or create actions to > only go through with the change if the user is an admin. If the user > isn''t an admin then store the submitted parameters. One way of viewing > might be to say that users never submit to the update or create > actions - their forms only ever create change request objects which > can then be reviewed by admins. > > Fred > > > Kind of a like a confirmation system.. > > > Hopefully you guys can help me out, I''m not that good at ruby on > > rails, but hopefully ill get better :) > > > Thanks for your help!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
It seems like you are over complicating this. Why not just add an "Approved" field (or something similar) to the model? You can then allow admins to set the Approved field to true. You can setup security around this field so that only admins can edit it. Within your application, you can then filter records based on the Approved/Not Approved flag as necessary. Eric On Apr 6, 3:27 pm, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hmm great explanation. I''m not that great at ror, so could u briefly > show me some sample Create/form code that stores the fields, and > transfers them to an admin? > > Do i need to create a whole new database for pending requests? > > Thanks > > On Apr 6, 6:24 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > On Apr 6, 11:08 pm, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey, > > > > I''m not sure how complex this really is, but i hope it isn''t too > > > difficult for you guys to explain here > > > > My question is, is there a way to intercept a Submit action (for a > > > scaffold, etc) of a form, and take that submit action and present it > > > to an ADMIN user, where he/she can either finish submitting the form, > > > or ignore the request? > > > Well it should be relatively simple in the update or create actions to > > only go through with the change if the user is an admin. If the user > > isn''t an admin then store the submitted parameters. One way of viewing > > might be to say that users never submit to the update or create > > actions - their forms only ever create change request objects which > > can then be reviewed by admins. > > > Fred > > > > Kind of a like a confirmation system.. > > > > Hopefully you guys can help me out, I''m not that good at ruby on > > > rails, but hopefully ill get better :) > > > > Thanks for your help!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Ok great idea, thanks a lot, what type of field should that approved field be? There are boolean type fields aren''t they? Can i use those? Where are you guys learning ruby on rails? In my head, coming from other prorgamming backgrounds, i can chart out everything i need to do, just I don''t know the syntax. where do you guys go to learn? On Apr 6, 7:09 pm, "E. Litwin" <elit...-ur4TIblo6goN+BqQ9rBEUg@public.gmane.org> wrote:> It seems like you are over complicating this. Why not just add an > "Approved" field (or something similar) to the model? > > You can then allow admins to set the Approved field to true. You can > setup security around this field so that only admins can edit it. > Within your application, you can then filter records based on the > Approved/Not Approved flag as necessary. > > Eric > > On Apr 6, 3:27 pm, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hmm great explanation. I''m not that great at ror, so could u briefly > > show me some sample Create/form code that stores the fields, and > > transfers them to an admin? > > > Do i need to create a whole new database for pending requests? > > > Thanks > > > On Apr 6, 6:24 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > On Apr 6, 11:08 pm, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey, > > > > > I''m not sure how complex this really is, but i hope it isn''t too > > > > difficult for you guys to explain here > > > > > My question is, is there a way to intercept a Submit action (for a > > > > scaffold, etc) of a form, and take that submit action and present it > > > > to an ADMIN user, where he/she can either finish submitting the form, > > > > or ignore the request? > > > > Well it should be relatively simple in the update or create actions to > > > only go through with the change if the user is an admin. If the user > > > isn''t an admin then store the submitted parameters. One way of viewing > > > might be to say that users never submit to the update or create > > > actions - their forms only ever create change request objects which > > > can then be reviewed by admins. > > > > Fred > > > > > Kind of a like a confirmation system.. > > > > > Hopefully you guys can help me out, I''m not that good at ruby on > > > > rails, but hopefully ill get better :) > > > > > Thanks for your help!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
David Zhu wrote:> just I don''t know the syntax. where do you guys go to learn?The PickAxe book (Programming Ruby) and Agile Web Development with Rails (slightly less useful nowadays for me) rarely leave arms-reach from my desk (along with Deploying Rails Applications <- you want to read this, you just don''t know it yet, and Advanced Rails Recipes <- great book for ideas). So shoot me... but I''m a fairly pragmatic programmer myself. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
David, I don''t know if this would help you, but you might poke around in http://github.com/subwindow/needs_approval for some ideas. I''ve not used it, so I don''t know how mature it is. On Tue, Apr 6, 2010 at 5:08 PM, David Zhu <dzwestwindsor45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey, > > I''m not sure how complex this really is, but i hope it isn''t too > difficult for you guys to explain here > > My question is, is there a way to intercept a Submit action (for a > scaffold, etc) of a form, and take that submit action and present it > to an ADMIN user, where he/she can either finish submitting the form, > or ignore the request? > > Kind of a like a confirmation system.. > > Hopefully you guys can help me out, I''m not that good at ruby on > rails, but hopefully ill get better :) > > Thanks for your help! > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''d have to agree with Ar Chron, it sounds like you need the PickAxe book from the PragProg publishers, along with AWDwR - both of which should be required reading for noobs. Personally, I went on a turbo learnig curve and went on after those two books with Metaprogramming Ruby, again from Dave & Andy @ PragProg, and haven''t looked back. It does depend on your knowledge level though. Don''t try and run before you can walk. If you are from a OO background then get stuck in and make sure you checkout Meta...Ruby. If you are new to OO, then take your time with the PickAxe book and AWDwR, once you ''think'' you understand those, then maybe move on to Meta...Ruby => you can always step back if you need to..... As a reult of Meta...Ruby, I have just refactored 100''s of lines of biolerplate crap (due to the point I was at in my learning curve with my initial learning project) to a few Ruby modules containing no more than 50 lines of code each - Ruby is a great language (thanks Matz :)) and it is well worth learning its basics first in order to move on after that..........take some time learning to Jog on the spot, after a while you will find yourself sprinting the 100m''s in under 8 secs........... You seem to have your RoR terms mixed up a bit. Forget about the ''scaffold'' as such. That is what the generator creates at your command in order to provide you with a starting point for your application - none of it is written in stone - all of it can be tweaked, changed, re- written. Don''t forget, you can generate models, migrations, etc. All that the generator is, is Ruby code that creates files based on the Rails Framework to save you the job of creating those files manually. The generator created scaffold includes, most imprortantly (in my eyes); your controllers, your models and your migrations. Also created are your Views and test beds. Personally, I don''t care about the Views, because I use Flex for the front end which connects to RoR via Flash''s RemoteObject and RubyAMF. I hold my hand up to say I need to look more into the test files (fixtures, unit, helpers, etc) myself. Haven''t found the need for those yet due to creating EXE''s that test my DB and server functionality - they may save me some work as per most of the RoR framework - just need to find the ROI for the learning curve... Your ''Submit'' action has nothing to do with your scaffold, other than, presumably, your submit button in your generated scaffold View. Your original question sounds like the following: User accesses and fills in the form User submits the form Administrator (of sorts) receives notification the form has been submitted Administrator accepts or dismisses the submitted form If so, then all you need to do, is to set up your DB to accept new submissions. You can then decide how you want your Administrator to be notified : this would depend on Application/Business/Project specific directives - Admin logs in and downloads latest submissions written to the DB, latest submissions get written to a log file that the Admin can access, Admin gets e-mail confirming latest submission etc. Is this correct? Regards Paul On Apr 7, 4:36 am, Ryan Waldron <r...-L2nCScK6t0HQT0dZR+AlfA@public.gmane.org> wrote:> David, I don''t know if this would help you, but you might poke around > inhttp://github.com/subwindow/needs_approvalfor some ideas. I''ve > not used it, so I don''t know how mature it is. > > On Tue, Apr 6, 2010 at 5:08 PM, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hey, > > > I''m not sure how complex this really is, but i hope it isn''t too > > difficult for you guys to explain here > > > My question is, is there a way to intercept a Submit action (for a > > scaffold, etc) of a form, and take that submit action and present it > > to an ADMIN user, where he/she can either finish submitting the form, > > or ignore the request? > > > Kind of a like a confirmation system.. > > > Hopefully you guys can help me out, I''m not that good at ruby on > > rails, but hopefully ill get better :) > > > Thanks for your help! > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
wow paul thanks so much for that explanation. You are correct on what I''m trying to do. Great. Lightbulb moment. 5 star post right there, thanks a lot :D :D :D :D -David On Apr 7, 7:51 pm, paul h <p...-nqL44GTounsJ3nxcUk3PyQ@public.gmane.org> wrote:> I''d have to agree with Ar Chron, it sounds like you need the PickAxe > book from the PragProg publishers, along with AWDwR - both of which > should be required reading for noobs. Personally, I went on a turbo > learnig curve and went on after those two books with Metaprogramming > Ruby, again from Dave & Andy @ PragProg, and haven''t looked back. > > It does depend on your knowledge level though. Don''t try and run > before you can walk. If you are from a OO background then get stuck in > and make sure you checkout Meta...Ruby. If you are new to OO, then > take your time with the PickAxe book and AWDwR, once you ''think'' you > understand those, then maybe move on to Meta...Ruby => you can always > step back if you need to..... > > As a reult of Meta...Ruby, I have just refactored 100''s of lines of > biolerplate crap (due to the point I was at in my learning curve with > my initial learning project) to a few Ruby modules containing no more > than 50 lines of code each - Ruby is a great language (thanks Matz :)) > and it is well worth learning its basics first in order to move on > after that..........take some time learning to Jog on the spot, after > a while you will find yourself sprinting the 100m''s in under 8 > secs........... > > You seem to have your RoR terms mixed up a bit. Forget about the > ''scaffold'' as such. That is what the generator creates at your command > in order to provide you with a starting point for your application - > none of it is written in stone - all of it can be tweaked, changed, re- > written. Don''t forget, you can generate models, migrations, etc. All > that the generator is, is Ruby code that creates files based on the > Rails Framework to save you the job of creating those files manually. > > The generator created scaffold includes, most imprortantly (in my > eyes); your controllers, your models and your migrations. Also created > are your Views and test beds. Personally, I don''t care about the > Views, because I use Flex for the front end which connects to RoR via > Flash''s RemoteObject and RubyAMF. I hold my hand up to say I need to > look more into the test files (fixtures, unit, helpers, etc) myself. > Haven''t found the need for those yet due to creating EXE''s that test > my DB and server functionality - they may save me some work as per > most of the RoR framework - just need to find the ROI for the learning > curve... > > Your ''Submit'' action has nothing to do with your scaffold, other than, > presumably, your submit button in your generated scaffold View. Your > original question sounds like the following: > > User accesses and fills in the form > > User submits the form > > Administrator (of sorts) receives notification the form has been > submitted > > Administrator accepts or dismisses the submitted form > > If so, then all you need to do, is to set up your DB to accept new > submissions. You can then decide how you want your Administrator to be > notified : this would depend on Application/Business/Project specific > directives - Admin logs in and downloads latest submissions written to > the DB, latest submissions get written to a log file that the Admin > can access, Admin gets e-mail confirming latest submission etc. > > Is this correct? > > Regards > > Paul > > On Apr 7, 4:36 am, Ryan Waldron <r...-L2nCScK6t0HQT0dZR+AlfA@public.gmane.org> wrote: > > > David, I don''t know if this would help you, but you might poke around > > inhttp://github.com/subwindow/needs_approvalforsome ideas. I''ve > > not used it, so I don''t know how mature it is. > > > On Tue, Apr 6, 2010 at 5:08 PM, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hey, > > > > I''m not sure how complex this really is, but i hope it isn''t too > > > difficult for you guys to explain here > > > > My question is, is there a way to intercept a Submit action (for a > > > scaffold, etc) of a form, and take that submit action and present it > > > to an ADMIN user, where he/she can either finish submitting the form, > > > or ignore the request? > > > > Kind of a like a confirmation system.. > > > > Hopefully you guys can help me out, I''m not that good at ruby on > > > rails, but hopefully ill get better :) > > > > Thanks for your help! > > > > -- > > > 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-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm. > > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.