A subscription is required to view this video. Enroll Today

Ruby

Rails App From Scratch - Part 1

  • jvancleef
  • 2688 views

We build an entire Rails application from scratch, showing you every single step in the process. Models, associations, nested routes, versioning, styling, validations and everything in-between.

This is the first part of an on-going series, we leave you on a code challenge you can attempt to complete before the next episode is published.

Comments

Zach said

Absolutely none of this is useful. The pace is fine but every step breaks something and while he's off speeding ahead you have to spend tons of time trying to get it to magically duplicate what he does. Not to mention the time spent trying to work out Postgres (pointless for a demo app like this - I get that it's for deployment but it's far easier to just add pg to your Gemfile deploy group on deployment) and configure Twitter Bootstrap which doesn't work out of the box. (Like others have said use gem 'twitter-bootstrap-rails', '2.1.3' ).

I love everything about code school, but I'm seriously disappointed by the quality of this screencast. Big waste of time.

Miha Zelnik said

I'm having problem with this error when i want to create new destination ActiveRecord::RecordNotFound in DestinationsController#create

tom netzband said

For anyone running into some issues, here are some answers that worked for me: (btw, I'm on Mac OSX 10.7.5)

ERROR: rake aborted errors / authentication failed for user wandrr: (I used homebrew to install postgres) - I had to jump into a new terminal window and add a new role for postgres. 1) in terminal, cd to your rails app directory 2) "$ psql -d postgres" to get into psql 3) then "postgres=# create role wandrr login createdb;" 4) then "postgres=# \q" to exit

ERROR: Cannot load such file -- less Installing the less-rails gem and therubyracer gem fixes this. My gemfile order is:

gem 'less-rails' gem 'therubyracer' gem 'twitter-bootstrap-rails'

(you might only need therubyracer though, I had both because I'm a super noob) Save that to your Gemfile and then run "$ bundle" again from in terminal from within your rails app directory.

Hopefully that helps some people out.

Richard Lau said

FYI for anyone using windows. you can install the latest 'twitter-bootstrap-rails' gem but instead of just doing 'rails g bootstrap:install' you have to do "rails g bootstrap:install static'. This will install the default css files instead of the LESS files. You have less customization when you don't use LESS.

Richard Lau said

im having issues when I install bootstrap onto my app. I am on windows and this what I get cannot load such file -- less

Richard Lau said

wow that bootstrap rails setup is awesome. thanks for the tips. a little bit too fast but i'll just hit reply a couple more times!

said

My nav bar is covering up the

Listing trips

part of my index page. Would love some help on how to fix this problem.

Albert Pak said

A quick update to this screencast would be nice, thank you John for mentioning that we'd need to use gem 'twitter-bootstrap-rails', '2.1.3' to follow this tutorial, since new updated gem has other dependencies.

Grecoroman14 said

Great video so far, but I'm having some trouble at 3:27 where you type 'rake db:migrate'. After it runs it then says 'rake aborted! fe_sendauty: no password supplied

Tasks: TOP => db:migrate (see full trace by running task with --trace)'

My database.yml file looks like this: development: adapter: postgresql encoding: unicode database: wandrr_development pool: 5 username: postgres password:

Not really sure where to go from here. Any thoughts? Thanks

amul patel said

this is awesome!! thanks for NOT doing ANY TEST DRIVEN DEVELOPMENT.

TDD is great .. but it adds another LAYER of complexity and VIEWER FATIGUE.

In fact for novices its just enough overhead to push them away...

Matt Payne said

Great video. Thanks for making it.

Would you please talk about how to get it running on heroku? I get a "ActionView::Template::Error" but am too new to fix it easily.

vjotov said

C:\Sites\e3>bundle Fetching source index for https://rubygems.org/ Using rake (10.0.2) Using i18n (0.6.1) Using multi_json (1.3.7) Using activesupport (3.2.1) Using builder (3.0.4) Using activemodel (3.2.1) Using erubis (2.7.0) Using journey (1.0.4) Using rack (1.4.1) Using rack-cache (1.2) Using rack-test (0.6.2) Using hike (1.2.1) Using tilt (1.3.3) Using sprockets (2.1.3) Using actionpack (3.2.1) Using mime-types (1.19) Using polyglot (0.3.3) Using treetop (1.4.12) Using mail (2.4.4) Using actionmailer (3.2.1) Using arel (3.0.2) Using tzinfo (0.3.35) Using activerecord (3.2.1) Using activeresource (3.2.1) Using bundler (1.0.22) Using coffee-script-source (1.4.0) Using execjs (1.4.0) Using coffee-script (2.2.0) Using rack-ssl (1.3.2) Using json (1.7.5) Using rdoc (3.12) Using thor (0.14.6) Using railties (3.2.1) Using coffee-rails (3.2.2) Using commonjs (0.2.6) Using jquery-rails (2.1.3) Using less (2.2.2) Using less-rails (2.2.6) Installing libv8 (3.3.10.4) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension .

    C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb

*** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/RailsInstaller/Ruby1.9.3/bin/ruby Checking for Python...Unable to build libv8: Python not found!

Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9 .1/gems/libv8-3.3.10.4 for inspection. Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/libv8-3.3 .10.4/ext/libv8/gem_make.out An error occured while installing libv8 (3.3.10.4), and Bundler cannot continue.

Make sure that gem install libv8 -v '3.3.10.4' succeeds before bundling.

vjotov said

Hello again,

for my case I put hard-code fix in C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb

line 54 becomes:

# @dir = File.join Gem.user_home, '.gem', 'specs'

@dir = File.join 'C:\\RailsInstaller\\userfolder', '.gem', 'specs'

#@update_cache = File.stat(Gem.user_home).uid == Process.uid

@update_cache = File.stat('C:\\RailsInstaller\\userfolder').uid == Process.uid

vjotov said

Great video,

But I have trouble executing the command on 02:27 - bundle install.

I got the following error: C:\Sites\e3>bundle install Fetching source index for https://rubygems.org/ C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:54 :in stat': No such file or directory - C:/Documents and Settings/ф (Errno::ENOE NT) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/spec_ fetcher.rb:54:ininitialize' ........

I triple-checked that I have the folder "C:/Documents and Settings/ф" Foldername "Ф" is correct Cyrillic letter with ASCII code 0xAA (http://www.ascii-codes.com/cp855.html)

What could you suggest for my case?

Tristan Smith said

Just want to mention some bugs i ran into. After the setting of only: :index, the index page has issues with the destination_path (edit_path etc) as these routes no longer exist, you have to modify the index template to use trip_destination_path(destination.trip,destination) or [destination.trip,destination]

Also due to the dependencies when you delete a trip things go awry with the destinations so modify to has_many :destinations, dependent: :destroy

John said

There has been a change to twitter-bootstrap-rails that requires some additional gems (less, therubyracer/execjs). To get the same experience as this tutorial, use the same version gem 'twitter-bootstrap-rails', '2.1.3'

If you want to experiment with later versions, I would do so after getting everything else working.

Joshua Beers said

I am having trouble with this at the very beginning using the bootstrapper. I am on windows 7, and it seems that I can't use the twitter-bootstrap-rails gem due to conflicts between therubyracer gem and the libv8 gem. I seem to be able to do everything else in the tutorial just fine. My google search comes up with no real way to get around the therubyracer problem other than moving to a linux/mac os. Is there a possible workaround for the bootstrap?

Steve Castaneda said

Thanks for this! Decided to run my scaffold generators with the --skip-stylesheets flag, because the default scaffolds css tends to screw with Bootstrap button stylings (in my experience).

Did the extra code work you mentioned (activities) and spent some time making sure strings mentioning trips, destinations, and activities were links going to the appropriate resource.

Looking forward to deploying in the next one!

Diogo Vincenzi said

I just watched this here at work. Extremely useful to see how the basic initial workflow of a rails app works. If I have some time to kill at home, I'll try and do the sample app. Can't wait to see part 2 :)

Download

Share