rails6kobe
6th Kansai Rails meeting in Kobe
On 20-Jan-2007 there was the 6th Kansai Rails meeting
just some notes
BBS with Rails
Nanki-san
- What is Rails?
- MVC
- Create the model
- scaffold
- make it more BBS-looking like
- Fix the View
See also: rails_lesson_6.pdf
XML-DBI Rails
Tsunenori-san
What is XML – cocktail recipe in XML ;)
ODF (OpenOffice format) is also XML based!
What is XML-DB?
Save a bunch of XML files together + queries for example wiski-based cocktails?
XPath, XQuery
TX1 – native XML database Relational database + patches for XML
- RoR
- REXML – 100% ruby
- DB2 on Rails – adapter for rails
- DB2 v9.1 Express-C – can handle sql and xml records (hybrid db)
Sample application – coctail bar ;)
* migratet.column "recipe", :xml <- !!!!* index
find_by_sql("xquery
for $recipe in db2-fn:xmlcolumn('.....')
order by fn:abs($recipe//@number)
return <Recipe>...
)
* show
find_by_sql([select * from cocktails where
xmlexists("$r/Recipe[@number = \"?\"....])
xquery let $ingnames = fn:distinct-values(....).....
[//ingradient/name = $ing]
> db2 register xmlschema .... > db2 select xmlvalidate(...)
in Rails:
* model
def self.validate_recipe?(..) find_by_sql("select xmlvalidate(..."))
http://www.alphaworks.ibm.com/tech/db2onrails
Rubist SNS
Katsuhiko-san
What is SNS?
current RubyistSNS is on PHP (OpenPNE)
put there the things which missing in Mixi !!!
Used software
RadRails, Rails Platform – http://railsplatform.jp/ , emacs-rails
mongrel, gettext
act_as_auth.., act_as_taggable, act_as_versioned, security_extensions
Modeling – STI single table inheritance
Selenium for testing?
See also
Rails tips
Ujihisa-san
HTML
- autoescape plugin, act_as_raw if needed
- safe erb plugin, inverse h – reverse with h and without.
CSS/JS
- image_path, relative path plugin
Rails BDD
- RSpec on Rails
Deploy
- capistrano
JIT on Rails – very interesting. Just upload your application and they will run it for you.
Questions:- automated?
- secure – what if somebody overwrite db:migrate
- chrooted? – vserver, openvz
Linux + Pound + Mongrel + SQLite3 – i suggested them to use nginx
See also
“Gentle on Rails” ;)
Maiha-san
the biggest problem is 1:n relations
foreign key (FK) !!! – id from other table
has_many :through
- Problems with FK
tables becoming just a set of indexes to other tables
Butterflay effect (Wikipedia)
id,company join id,people → id,company,id,people
acts_as_view, scoped_access – are they needed?
devide must have and others part of the data
web2.0 – everything is flat with a bunch of relation tables (tags)
| FK | ? | ||
| 1:1 | has_one, belongs_to | (habto) | (has_one :through) |
| 1:n | has_many, belongs_to | (habtm) | has_many :throught |
| n:n | x | habtm | has_many :through |
(..) still do not exists in Rails (but is good to have them)
define_method(name) { send(habtm).first }