Forum: Ruby on Rails Complete newbie questions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2c0ca896df6da6f6764796aaae84e4f5?d=identicon&s=25 dlittle (Guest)
on 2009-04-29 23:51
(Received via mailing list)
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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-04-30 00:20
(Received via mailing list)
On Apr 29, 9:04 pm, dlittle <dlittle.nos...@gmail.com> 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

>
> 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.
>
you may be interested in the if/unless options for validations -
they're quite flexible.

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

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

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

> 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.
>
A before save callback on the model class that encrypts the data would
probably do the trick.

Fred
This topic is locked and can not be replied to.