Cov txheej txheem:

Pib Nrog Kev Ruaj Ntseg: 17 Cov Kauj Ruam
Pib Nrog Kev Ruaj Ntseg: 17 Cov Kauj Ruam

Video: Pib Nrog Kev Ruaj Ntseg: 17 Cov Kauj Ruam

Video: Pib Nrog Kev Ruaj Ntseg: 17 Cov Kauj Ruam
Video: Zoo Siab Nrog Koj - Paj Tsua Thoj [ Official MV ] Nkauj Tawm Tshiab 2022 2024, Kaum ib hlis
Anonim
Pib Nrog Ntsia
Pib Nrog Ntsia

Koj puas tau pom lub vev xaib uas txias heev thiab sib tham koj tam sim xav tsis thoob "Lawv ua li ntawd li cas?". Zoo kuv yuav qhia koj ib txoj hauv kev uas nws tuaj yeem ua tiav. Tau kawg peb yuav tsis tsim ib qhov chaw zoo li Instructables kom pib nrog, tab sis cov hauv paus ntsiab lus tuaj yeem yooj yim loj hlob mus rau txhua qhov chaw koj tuaj yeem xav txog nrog ua haujlwm me ntsis.

Kauj Ruam 1: Tsis Txhob Rov Ua Koj Tus Kheej

"Tsis txhob rov ua koj tus kheej", cov lus no feem ntau ua raws "Dab tsi?" … tom qab ntawd koj rov hais dua "Tsis txhob rov ua koj tus kheej". Ib qho ntawm lub hauv paus ntsiab lus ntawm Ruby yog D. R. Y. yog li peb yuav lo ntawm qhov no ntau li ntau tau. Loj pib los ntawm kev nrhiav lub luag haujlwm uas muaj txiaj ntsig zoo. Qhov Rails yog txoj haujlwm zoo. Nyem rau ntawm qhov txuas thiab unzip cov ntaub ntawv mus rau cov npe uas tsis muaj qhov chaw (zoo li C:). Tsis txhob txhawj xeeb rau cov ntawv me nws siv sijhawm ntev rau unzip, qhov no yog vim muaj ntau daim ntawv me me uas nws muaj.

Kauj Ruam 2: Tsim Nplooj Lus

Tsim Ib Nplooj Ntawv Saib
Tsim Ib Nplooj Ntawv Saib

Ua ntej kom ntseeg tau tias koj tsis tau khiav lwm lub web server xws li IIS. Yog tias koj raug kaw tam sim no.

Tam sim no pib InstantRails.exe Nws yuav tshwm sim nug kom hloov kho cov ntaub ntawv teeb tsa. Xaiv OK

Kauj Ruam 3: Me Me Tom Qab

Me ntsis keeb kwm yav dhau los ntawm yuav ua li cas Ruby on Rails ua haujlwm tiag tiag.

Ruby on Rails ua haujlwm siv MVC tus qauv. Ntawd yog Qauv, Saib, thiab Tus Tswj. Tus Qauv yog ib feem uas ua txhua txoj haujlwm, nws yuav yog tus lej zauv, cov qauv khaws cia thiab lwm yam…. Lub View tsuas yog tus saib. Qhov no feem ntau yuav yog hom ntawv uas tau nthuav tawm rau lub vev xaib hauv peb qhov kev nthuav tawm. Tus Tswj Tus Kheej yog ib feem uas coj tus neeg siv nkag mus thiab xa nws mus rau Tus Qauv. Yog li koj pom Tus Neeg Siv cov ntawv nkag mus rau Tus Tswj, uas yog tom qab ntawd dhau mus rau Tus Qauv uas nws ua qee yam thiab spits nws rov qab mus rau Saib. Yooj yim txaus, tab sis nco ntsoov thaum peb mus dhau ob peb kauj ruam tom ntej.

Kauj Ruam 4: Tsim Daim Ntawv Thov

Tsim Daim Ntawv Thov
Tsim Daim Ntawv Thov

Ua ntej cia tsim cov ntsia app

Qhib lub qhov rai ruby los ntawm kev siv InstantRailsI icon nyob rau sab saud Rails ApplicationsOpen Ruby Consolw Window

Kauj Ruam 5: Ua Thawj Thawj Cov Lus txib

Ua Thawj Thawj Cov Lus txib
Ua Thawj Thawj Cov Lus txib

Hauv koj qhov qhib tshiab console qhov rai yam: ntsia cov lus pom

Kauj Ruam 6: Tsim Tus Tswj

Tsim Tus Tswj
Tsim Tus Tswj

Tam sim no peb ua tus tswj. Ntxiv mus rau phau ntawv teev npe tshiab: cd tawm tswv yimNtau hom: ruby tsab ntawv/tsim cov tswj cov lus

Kauj Ruam 7: Tsim Tus Qauv Qauv

Tsim Tus Qauv Qauv
Tsim Tus Qauv Qauv

Tam sim no peb tsim tus qauv tshiab hu ua Post. Qhov no yuav luag zoo ib yam rau qhov kawg. Type: ruby tsab ntawv/tsim qauv Post

Kauj Ruam 8: Finnaly Qee Yam Ruby Tiag

Finnaly Qee Yam Ruby Tiag
Finnaly Qee Yam Ruby Tiag

Mus rau hauv koj lub qhov rai tshawb nrhiav rau rails_appscommentdbmigrate

Qhib cov ntaub ntawv 001_create_posts.rb Nws yuav tsum qhib nrog SciTE, yog tias nws tsis yog koj yuav xav siv qhov ntawd rau qhov seem ntawm qhov ua piv txwv no.

Kauj Ruam 9: Ntxiv Cov Teb

Ntxiv Teb
Ntxiv Teb

Ntawm no peb yuav ntxiv Lub Npe thiab Cov Lus Teb. Muaj kab uas pib tsim_table insertt.column: npe,: stringt.column: tawm tswv yim,: ntawv khaws cov ntaub ntawv thiab kaw SciTE.

Kauj ruam 10: Qhov Config Nyob Qhov Twg

Qhov Config Nyob Qhov Twg
Qhov Config Nyob Qhov Twg
Qhov Config Nyob Qhov Twg
Qhov Config Nyob Qhov Twg

Cov kauj ruam nrawm los nrhiav seb koj lub database yuav tsum raug hu li cas. Mus rau cov ntawv tais ceev tseg thiab qhib cov ntaub ntawv database.yml nrog SciTE. yuav siv rau lub sijhawm tam sim no. Lub npe ntawm peb cov database yuav tsum yog kev pom zoo_ kev txhim kho

Kauj ruam 11: Tsim Database

Tsim cov Database
Tsim cov Database
Tsim cov Database
Tsim cov Database

Tam sim no hauv InstantRails hais kom ua qhov rai pib apache.

Koj yuav tsum tau thaiv qhov no ntawm koj lub firewall. Tom ntej no mus rau kuv iconConfigureDatabase (ntawm PhpMyAdmin)

Kauj Ruam 12: Tsim Database

Tsim cov Database
Tsim cov Database
Tsim cov Database
Tsim cov Database

Hauv lub vev xaib nrhiav lub npov uas muaj npe Tsim Tus Qauv Tshiab thiab sau lub npe ntawm cov ntaub ntawv uas peb xav tau. Nov yog: comment_developmentAccpet qhov tsis ua tiav thiab kaw lub qhov rai. Thaum lub sijhawm no mus tom ntej thiab kaw apache los ntawm tib txoj kev peb tau pib nws tab sis siv lub khawm nres lub sijhawm no xwb.

Kauj Ruam 13: Pib Ruby Server

Pib Ruby Server
Pib Ruby Server
Pib Ruby Server
Pib Ruby Server

Qhib lub qhov rai console tshiab (tam sim no koj yuav tsum muaj 2 qhib). Thiab peb yuav pib lub server. Ua ntej mus rau cov npe kab lus los ntawm cd saib Tam sim no cov tswv yim: ruby tsab ntawv/server

Kauj Ruam 14: Teeb Tus Tswj

Teeb Tus Tswj
Teeb Tus Tswj

Tam sim no peb xav teeb tsa tus tswj hwm rau server.

Mus rau app / controllers thiab qhib cov ntawv comments_controller.rb hauv SciTE

Kauj Ruam 15: Hloov Kho Tus Tswj

Kho kom raug tus maub los
Kho kom raug tus maub los

Hauv SciTE hloov kho tus tswj hwm los ntawm kev ntxiv caffold: txoj cai nyob nruab nrab.

Kauj Ruam 16: Hloov Db

Migrate Db tau
Migrate Db tau

Hauv koj thawj lub qhov rai hom rake db: migrateThis yuav npaj cov ntaub ntawv thiab thauj lawv rau saib.

Kauj Ruam 17: Saib Yam Peb Ua Tau

Saib Qhov Peb Ua Tau
Saib Qhov Peb Ua Tau

Qhib koj lub vev xaib rau https:// localhost: 3000/lus thiab saib nws zoo li cas.

Pom zoo: