Skip to content

Instantly share code, notes, and snippets.

@sigmaray
Created March 5, 2013 14:07
Show Gist options
  • Save sigmaray/5090532 to your computer and use it in GitHub Desktop.
Save sigmaray/5090532 to your computer and use it in GitHub Desktop.
zombie@zombieland:~/projects/sandbox/habtmbox$ rails c
SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
This poses a security threat. It is strongly recommended that you
provide a secret to prevent exploits that may be possible from crafted
cookies. This will not be supported in future versions of Rack, and
future versions will even invalidate your existing user cookies.
Called from: /home/zombie/.rvm/gems/ruby-1.9.3-p194@zombie/gems/actionpack-3.2.9/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.
Loading development environment (Rails 3.2.9)
1.9.3p194 :001 > club = Club.new; club.name = 'Dozari'; club.save
(0.1ms) BEGIN
SQL (97.4ms) INSERT INTO `clubs` (`created_at`, `name`, `updated_at`) VALUES ('2013-03-05 14:02:56', 'Dozari', '2013-03-05 14:02:56')
(76.7ms) COMMIT
=> true
1.9.3p194 :002 > club2 = Club.new; club2.name = 'Next'; club2.save
(0.2ms) BEGIN
SQL (33.1ms) INSERT INTO `clubs` (`created_at`, `name`, `updated_at`) VALUES ('2013-03-05 14:03:02', 'Next', '2013-03-05 14:03:02')
(76.8ms) COMMIT
=> true
1.9.3p194 :003 > idiot = Idiot.new; idiot.name = 'Zurab'; idiot.club_ids = [5, 6]; idiot.save
Club Load (0.4ms) SELECT `clubs`.* FROM `clubs` WHERE `clubs`.`id` IN (5, 6)
(1.2ms) BEGIN
SQL (18.0ms) INSERT INTO `idiots` (`created_at`, `name`, `updated_at`) VALUES ('2013-03-05 14:03:29', 'Zurab', '2013-03-05 14:03:29')
(0.1ms) INSERT INTO `clubs_idiots` (`idiot_id`, `club_id`) VALUES (3, 5)
(0.1ms) INSERT INTO `clubs_idiots` (`idiot_id`, `club_id`) VALUES (3, 6)
(71.8ms) COMMIT
=> true
1.9.3p194 :004 > club2.delete
SQL (136.6ms) DELETE FROM `clubs` WHERE `clubs`.`id` = 6
=> #<Club id: 6, name: "Next", created_at: "2013-03-05 14:03:02", updated_at: "2013-03-05 14:03:02">
1.9.3p194 :005 > exit
zombie@zombieland:~/projects/sandbox/habtmbox$ mysql -u root -h localhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 145
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> USE 'habtmbox';
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from clubs_idiots;
+----------+---------+
| idiot_id | club_id |
+----------+---------+
| 3 | 5 |
| 3 | 6 |
+----------+---------+
2 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment