I am very much a beginner to rails and I have a specific need for it. I wish to connect it to a flex app, and also use it to call a database.
For example when the following web page is visited:
?User=bob&id=4&lic=234
Take ‘bob’ and 4 and add them to an existing database table if the license number is valid and not already used. I don’t want to use the standard database stuff, I will need to write my own SQL queries as well as have logic for checking other stuff to do with registering users etc.
It is already done with Coldfusion but I am having issues with it, and would like to have it work with Ruby instead.
But to start with, I just want the ability to call a web page (on localhost:3000) get the string after the URL “?User=bob&id=4&lic=234” in this case and output “User:bob id:4” to the screen. I want to learn what the code is doing rather than have the least lines of code solution. I would rather use as little of the rails framework to do this as this will help me learn the language. I won’t be making the standard website so learning the rails framework won’t be so useful to me.
Thanks for the comments, sinatra seems to be what I’m looking for, however I am having problems connecting with databases, mysql in this case:
I’m following this:
http://community.active.com/blogs/productdev/2011/02/28/using-activerecord-3-without-rails
Trying to use a Mysql database in this instance.
However I get this error:
LoadError: Please install the mysql adapter: gem install activerecord-mysql-adapter (193: %1 is not a valid Win32 application. – F:/Software/RubyStack/ruby/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/1.9/mysql_api.so)
So I tried:
gem install activerecord-mysql-adapter
However:
gem could not be found
So I did:
install instead activerecord-jdbcmysql-adapter-1.2.2
However it still didn’t work.
When this is working, how do you make arbitrary SQL calls?
Have a look at Thin or Sinatra and combine it with Active record. Using Active Record to handle your database and models is far superior to doing it all by yourself.
If you insist on doing it by yourself. You can use the mysql2 gem or postgresql gem directly