# Complete newbie questions

**URL:** <https://www.ruby-forum.com/t/complete-newbie-questions/166829>\
**Category:** Rails\
**Created:** [April 29, 2009, 11:51pm UTC](https://www.ruby-forum.com/t/complete-newbie-questions/166829 "2009-04-29T23:51:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlittle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aca169/32.png) [@dlittle](https://www.ruby-forum.com/u/dlittle)\
**Post date:** [April 29, 2009, 11:51pm UTC](https://www.ruby-forum.com/t/complete-newbie-questions/166829/1 "2009-04-29T23:51:36Z")

</div>

I’m just learning Rails and am starting out by reading LOTS of books  
and websites and converting a simple system (4 tables, 32 fields  
including keys and timestams, 3 web screens and 4 “admin” screens  
written in 4th Dimension) but a few questions still remain with how  
someone with Rails experience would approach a problem. If someone  
can either point me in the right direction or feels like building a  
new demo (I can send specs, screen shots of current system, etc if  
interested) that would cover these, it would be much appreciated.

The main system in question is a visitor check-in system where a host  
(the person they’re visiting) has an admin enter visitor info. Once  
entered, it shows up at the guard station where they’re checked in and  
then proceed to pick up a visitor badge.

Questions:

1. The guard station system is very simple. It shows a list of the  
expected visitors and beside each is a check box. The guard checks  
off all the visitors arriving in a vehicle (sometimes one, sometimes a  
busload) and presses submit. All the examples I’ve seen process a  
single record and that doesn’t work in this case.

2. For some views or for actions to be completed, I want certain  
fields to be required but in others, I do not want them to be  
required. At least at first glance, the controller seems to enforce  
this for all views. As an example, lets say I want users to come in  
and start an order with the ability to save it as a draft with no  
checking but before they can submit it, it has to have all the  
required stuff entered.

3. Everything I’ve seen so far relates to pulling data from a single  
web page on submit. In most of my databases, I’m pulling in LOTS of  
data (6 pages minimum) and then going to the next page. How are  
people handling intermediate page saves? Cookies is an option but I’d  
rather have it in the database since the user may move from one  
computer to another.

4. In some views, I want a login to be required and in other cases, I  
don’t. For example, I want to allow anonymous entries but I want an  
admin to have to view them before they’re officially posted. I  
haven’t quite gotten to the point in any book that covers  
authentication so this may be trivial.

5. Not quite related to Rails (or maybe it is) but what are others  
using for reporting – both built reports and ad hoc reports? Are you  
using Rails to generate the file and convert to PDF or are you using  
some other tool that works on the lower level database? While  
something like Crystal Reports would work great, it’s significant  
overkill and costs quite a bit.

6. I haven’t yet seen any way to encrypt data before it gets saved to  
the database and we collect some data that would be considered  
sensitive. What I do now i(not in Rails) s use a second pub/priv  
keypair to encrypt the data when it first comes in and then save that  
to a blob.

If you’re interested in building the demo, email me off-list and I’ll  
send you more info.

Thanks,

Dennis

---

<div class="post-metadata">

**Author:** ![dlittle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aca169/32.png) [@dlittle](https://www.ruby-forum.com/u/dlittle)\
**Post date:** [April 30, 2009, 12:20am UTC](https://www.ruby-forum.com/t/complete-newbie-questions/166829/2 "2009-04-30T00:20:17Z")

</div>

On Apr 29, 9:04 pm, dlittle [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> off all the visitors arriving in a vehicle (sometimes one, sometimes a  
> busload) and presses submit. All the examples I’ve seen process a  
> single record and that doesn’t work in this case.

Single records are the simple case but that doesn’t mean those are the  
only cases.  
For example if for each visitor you have a checkbox and the input name  
is foo[] and the value is the id of the visitor then when you submit  
the form params[:foo] will be an array with the values of the checked  
checkbox

> 1. For some views or for actions to be completed, I want certain  
> fields to be required but in others, I do not want them to be  
> required. At least at first glance, the controller seems to enforce  
> this for all views. As an example, lets say I want users to come in  
> and start an order with the ability to save it as a draft with no  
> checking but before they can submit it, it has to have all the  
> required stuff entered.

you may be interested in the if/unless options for validations -  
they’re quite flexible.

> 1. Everything I’ve seen so far relates to pulling data from a single  
> web page on submit. In most of my databases, I’m pulling in LOTS of  
> data (6 pages minimum) and then going to the next page. How are  
> people handling intermediate page saves? Cookies is an option but I’d  
> rather have it in the database since the user may move from one  
> computer to another.

having the session just contained the id of an ‘in progress’ database  
record is an option (or depending on how your app works it might be  
more appropriate for that to be a column on the users table.

> 1. In some views, I want a login to be required and in other cases, I  
> don’t. For example, I want to allow anonymous entries but I want an  
> admin to have to view them before they’re officially posted. I  
> haven’t quite gotten to the point in any book that covers  
> authentication so this may be trivial.

Without going into specifics this doesn’t sound very hard very hard.

> 1. I haven’t yet seen any way to encrypt data before it gets saved to  
> the database and we collect some data that would be considered  
> sensitive. What I do now i(not in Rails) s use a second pub/priv  
> keypair to encrypt the data when it first comes in and then save that  
> to a blob.

A before save callback on the model class that encrypts the data would  
probably do the trick.

Fred
