/usr/share/doc/gnokii-smsd-mysql/sms.tables.mysql.sql
mysql -uroot -pabc123 sms_development < sms.tables.mysql.sql
2.I'm going to generate the interface for inbox table.But first lets identify the table structure
+------------+------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------------------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| number | varchar(20) | NO | | | |
| smsdate | datetime | NO | | 0000-00-00 00:00:00 | |
| insertdate | timestamp | NO | | CURRENT_TIMESTAMP | |
| text | text | YES | | NULL | |
| phone | tinyint(4) | YES | | NULL | |
| processed | tinyint(4) | NO | | 0 | |
+------------+------------------+------+-----+---------------------+----------------+
3.We are going to create the scaffold for number,text and smsdate
script/generate scaffold inbox number:string text:string smsdate:timestamp
4. Now repeat that for outbox table
script/generate scaffold outbox number:string text:string smsdate:timestamp
5. Since we are using non standard RoR table name, we need to change both models for inbox and outbox.
edit app/models/inbox.rb
class Inbox < ActiveRecord::Base
# gnokii legacy table inbox
set_table_name "inbox"
set_primary_key "id"
end
edit app/models/outbox.rb
class Outbox < ActiveRecord::Base
# gnokii legacy table outbox
set_table_name "outbox"
set_primary_key "id"
end
6. Now point your browser to http://localhost:3000/inboxes and http://localhost:3000/outboxes
7. Job's done
No comments:
Post a Comment