Archive for the ‘ROR’ tag
veryActiveRecord — seven12
السلام عليكم ورحمة الله وبركاته
7-12 framework now has better scaffolding and is clean urls [URL rewriting]
I’ve been working on it the last days but the very strange thing is .. I’m working shallow issues ..
Mainly, I forgot that seven12 have a MODEL problem .. Major problem .. it’s not yet an active record based one ..
so ..It’s not that handy if you tried to code your application if you didn’t not start from scaffolding then modifying, and in case you scaffolded you table you will still need to understand the fact of each model is a file and a different class which is -now- sounds so illogical to bind them all to a parent “doing a singleton connection–which almost nothing” class ..!
Sooo ..
I decided to code “veryActiveRecord” which will work on the 2-ways
1-it’ll enable you to have the row to object model
2-It’ll have the Object to row model through what I call “inversed scaffold”
Ex.
//normal active records ..
//assuming the table users exist “note the convention of plural table names will be fixed on scaffolding part ..”
//users table contains the four columns / fields id name email which is INT PK auto_increment NOT, varchar(50), varchar(200), respectively
$values=array(id=>NULL,
‘name’=>’Ahmed’,
‘email’=>’ahmed@ahmed.com’);
$user = new User();
$user->add($values);//this will work exactly like sending the query:
//insert into users values (NULL,’Ahmed’,'ahmed@ahmed.com’);
//user class contain relation parameter “class variable” describing the relation to other tables..
//which will be as high leveled as ROR “Ex. belongs to and has many ..”
Next is the inversed scaffolding ..
//my plan is to have no table sql already designed..
//developer will design how to handle the fields before creation
//inside the users class
$relations=array(‘has manyusers
‘,’belongs to
groups
‘);
$id = new intField();
$name = new strField(“unique”);
$email = new strField(“searchable”);
//and I’ll copy a feature from DJango calle s=dbsynch you will be able a fully compatible to your code SQL which can be directly or indirectly “copy paste to your console/phpMyAdmin” executed .
…
Well, It sounds a lot of code to write ..
but It sounds also sooo interesting when it’s done -that way- as it is a challenge for me ![]()
and I just love challenges ..
NOTE:
I’ll pause working on scaffolding for the moment ..
clean URLs will remain with the same procedure
better mail and better template engine is what I’m planning for ..
and there was a very important thing to talk about which I forgot while writing that topic ..
Make a prayer to remember ..
إن شاء الله ..
7-12-2008 will be a nice release isA
;may be the 1.0 release ..!
Salam