Actually, I believe this is even simpler than you think.

Why don't you have a process which is:

People enter the ticket number
After validation they are directed to the download page.

You don't need to check if the ticket is in the database, you add it anyway.
Later, you'll be able to list the tickets entered and to count them.

if you use the scaffold, you have the new page that takes care of entering the 
ticket
This should use the create action in which you put the validation code and make 
sure that it redirects to the download page
The index page can be tuned to display the list of tickets and their respective 
count

You don't need the update page nor delete page

Doesn't seem a big deal to me

Christophe 

Le 30 mars 2010 à 19:18, partydrone a écrit :

> I want to create a simple app.
> 
> On one page, I want a form. This form has a single field for a ticket
> number. When someone enters a ticket number and submits the form, they
> are shown a second page with links to download files. And here is a
> list of other criteria:
> 
> - validate ticket numbers (is a number within a certain range)
> - "used" tickets are stored in the database
> - if a ticket is not in the database, add it
> - if a ticket is in the database, increase "count" field by one
> 
> This seems simple enough, but I don't quite understand how to take all
> of rails discrete processes (create using POST, update using PUT, show
> using GET, all in separate actions within a controller) and roll it
> all up into a single controller (or put it in the model, which makes
> sense).
> 
> Should I scrap trying to use ActiveRecord and go to straight Ruby for
> this? I've never done database access straight from Ruby before.
> 
> Here's the code: http://github.com/partydrone/ticket_check
> 
> Any suggestions would be helpful. Thank you.
> 
> -- 
> 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.
> 

-- 
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.

Reply via email to