Hello Chris: I understand what you are attempting to do, but not sure the reasoning behind it. In regards, to a new or edit forms, I would be incrementing the account number when the form is posted. It might be worth looking at the interface patterns developers use for ROR web applications rather than thinking in terms of desktop Foxpro patterns.
However having said that, to add additional methods, in a RESTFul world I probably add it as another resource/controller. For example, to increment an account number I would create a controller called AccountNumbersController (i.e. for the resource account_number) with an update method that does the increment. But without knowing your domain model this might be bad advice. As a last resort, you can always add it as another method in the controller, but I like to keep the controllers to the REST methods, and identify the resource I'm attempting to update and create a controller for that. Cheers, Nicholas On Sep 2, 1:57 pm, internetchris <[email protected]> wrote: > So this is a question that I keep trying to think through in my head > and it's the first time I've had to implement it in an application. I > come from a Visual Foxpro background and when I would want to add a > button to a form I could simply place it on the form and then modify > the clickevent with my custom code for that button. > > In rails if I'm working on the New or Edit form I want to add a > button that finds the last record in the table, take the account > number, and then increment it by one and then replace the contents of > the account field on my form with that new number. Here's my > question.... > > Do I add a separate method in my controller simply for this button (ie > increment_account) or something like that? If I do this, how do I call > that from my view? Do I always call it within a form by itself? This > are fairly general questions, and probably ones I should know the > answer to, but I'm finding that I'm not entirely sure how to implement > little buttons that do special things within the "new" or "edit" > views. If someone has the time to give me an example that would be > awesome . I just want to know the proper way to implement something > like this.. > > Thanks! > > Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

