how can i write to a mysql table with ruby ? run SQL. for example, if the ruby script finishes, write to mysql table saying its done and how can i generate an absolutely unique ID ? kinda like youtube’s id.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For the unique ID, it’s pretty easy. You should take a look at mysql’s auto increment.
For mysql with Ruby, you need to use the mysql gem.
Using it is also pretty easy. You could do something like the following :
And if you’re planning to build something consequent, you might also be interested in using Active Record.