creating rails app n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Creating rails app PowerPoint Presentation
Download Presentation
Creating rails app

Loading in 2 Seconds...

play fullscreen
1 / 11

Creating rails app - PowerPoint PPT Presentation


  • 146 Views
  • Uploaded on

Creating rails app. p :\InstantRails\rails_apps>rails -d mysql cars create create app/controllers create app/helpers create app/models create app/views/layouts create config /environments create config /initializers create db create doc create lib

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Creating rails app' - sidone


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide2

p:\InstantRails\rails_apps>rails -d mysql cars

create

create app/controllers

create app/helpers

create app/models

create app/views/layouts

create config/environments

create config/initializers

create db

create doc

create lib

create lib/tasks

create log

change to cars dir
Change to cars dir

P:\InstantRails\rails_apps>cd cars

P:\InstantRails\rails_apps\cars>rake db:create:all

(in P:/InstantRails/rails_apps/cars)

P:\InstantRails\rails_apps\cars>ruby script/generate scaffold Corvette body_styl

e:string miles:floatyear:integer

exists app/models/

exists app/controllers/

exists app/helpers/

create app/views/corvettes

exists app/views/layouts/

exists test/functional/

exists test/unit/

create app/views/corvettes/index.html.erb

….(more)

instantrails r ailsapps cars db migrate 001 create corvettes rb
Instantrails/railsapps/cars/db/migrate/001_create_corvettes.rbInstantrails/railsapps/cars/db/migrate/001_create_corvettes.rb

class CreateCorvettes < ActiveRecord::Migration

defself.up

create_table :corvettes do |t|

t.string :body_style

t.float :miles

t.integer :year

t.timestamps

end

end

defself.down

drop_table :corvettes

end

end

create db by running migrate
Create db by running migrate

P:\InstantRails\rails_apps\cars>rake db:migrate

(in P:/InstantRails/rails_apps/cars)

== 1 CreateCorvettes: migrating ===============================================

-- create_table(:corvettes)

-> 0.0780s

== 1 CreateCorvettes: migrated (0.0780s) ======================================

run server from p drive it is all very slow
Run server… from p drive it is all very slow

P:\InstantRails\rails_apps\cars>ruby script/server

=> Booting Mongrel (use 'script/server webrick' to force WEBrick)

=> Rails application starting on http://0.0.0.0:3000

=> Call with -d to detach

=> Ctrl-C to shutdown server

** Starting Mongrel listening at 0.0.0.0:3000

** Starting Rails with development environment...

app models corvette rb adding validation
App/models/corvette.rb --- adding validation

class Corvette < ActiveRecord::Base

validates_presence_of :body_style, :miles, :year

validates_numericality_of :year, :greater_than=>1952, :less_than_or_equal_to=>Time.now.year

end