Quick'n dirty PHP form. How?

Kevin Fries kevin at fries-biro.com
Wed Apr 8 22:18:12 MST 2015


Yea,

Stop using PHP.

$ gem install rails
$ cd ~/projects
$ rails new mydbentry

By default it will create a new database using sqlite3.  If you have an
existing database using a different DBMS, you can specify which one on the
rails new line by adding -- database=mysql, or whichever db you used.

$ cd mydbentry

Add the following line to your Gemfile (it just works better)

gem "puma"

Update config/database.yml with your database credentials

$ bundle update
$ rails generate scaffold tablename field1:type field2:type field3:type etc

I.E. rails: generate scaffold employee last:string first:string ssn:string
notes:text

Open config/routes.rb and find a line (about 8-10 lines down from the top)
that is commented out that says root :to =>.
Create a new non-commented line just like it, but instead of welcome#index
yours should be tablename#index

If you allowed rails to create a new database for you instead of using an
existing one...

$ rake db:create
$ rake db:migrate

Now run the server

$ puma

Use a Web browser of your choice and access the page on port 9292.

Should take no more than 5 minutes to set up.  It actually is harder to
explain than to do.  5 minutes is a generous estimate, 30 seconds is more
likely.

If the form is too ugly/basic for you, edit it at app/views/tablename/...

Happy inputting

Kevin
On Apr 8, 2015 8:22 PM, <kitepilot at kitepilot.com> wrote:

> Hello list:
> I want to build a form to have non-puter people help me fill up some
> tables. There is no math, no aesthetics and no design, most validations are
> build it inside the database.
> I just need a quick'n dirty way to build the forms, any recommendations?
> Thanks!
> ET
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20150408/2bb1023b/attachment.html>


More information about the PLUG-discuss mailing list