Coder Social home page Coder Social logo

rails-4.2-book's People

Contributors

derlordi avatar mojavelinux avatar wintermeyer avatar

Watchers

 avatar  avatar  avatar

Forkers

jurinco

rails-4.2-book's Issues

Duplicated code in chapter05-scaffolding.md

The following code is duplicated (around line 945):

$ rake routes                                                                   
  Prefix Verb URI Pattern             Controller#Action
products GET  /products(.:format)     products#index
 product GET  /products/:id(.:format) products#show

Remove wrong code/output in chapter05-scaffolding.md

Around line 55 there is the following code/output which doesn't make sense.

$ rails generate scaffold
^C^C/Users/xyz/.rvm/gems/ruby-2.2.0/gems/spring-1.3.4/lib/spring/application.rb:156:in `fork': Interrupt                                                        
  from /Users/xyz/.rvm/gems/ruby-2.2.0/gems/spring-1.3.4/lib/spring/application.rb:156:in `serve'
  from /Users/xyz/.rvm/gems/ruby-2.2.0/gems/spring-1.3.4/lib/spring/application.rb:131:in `block in run'
  from /Users/xyz/.rvm/gems/ruby-2.2.0/gems/spring-1.3.4/lib/spring/application.rb:125:in `loop'
  from /Users/xyz/.rvm/gems/ruby-2.2.0/gems/spring-1.3.4/lib/spring/application.rb:125:in `run'
  from /Users/xyz/.rvm/gems/ruby-2.2.0/gems/spring-1.3.4/lib/spring/application/boot.rb:18:in `<top (required)>'
  from /Users/xyz/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /Users/xyz/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from -e:1:in `<main>'
MAC-00020:shop xyz$ rails generate scaffold

-bash: tree: command not found

It seems that the command tree is not a standard on every bash console.

MAC-00020:shop richertd$ tree app/views/products/
-bash: tree: command not found

we could use find instead?

MAC-00020:shop richertd$ find app/views/products/
app/views/products/
app/views/products//_form.html.erb
app/views/products//edit.html.erb
app/views/products//index.html.erb
app/views/products//index.json.jbuilder
app/views/products//new.html.erb
app/views/products//show.html.erb
app/views/products//show.json.jbuilder

What do you think?

Wrong URL and Markdown error

The following code in chapter06-routing.md needs to be fixed. See the screenshot.

Plus: The URLs are missing the 3000.

Please double check other chapters by browsing through https://www.gitbook.com/content/book/wintermeyer/rails-4-2-book for this kind of error too.

The pages can be accessed at the following URLs after starting the Rails
server with `rails server`:

-   <http://localhost:300/home/index>

    for `home_index GET /home/index(.:format)
              home#index`

-   <http://localhost:300/home/ping>

    for `home_ping GET /home/ping(.:format)
              home#ping`

-   <http://localhost:300/home/pong>

    for `home_pong GET /home/pong(.:format)
              home#pong`

bildschirmfoto 2015-05-15 um 18 21 28

Remove links to xyzpub.com

Links should only be within the document or to external source which are unlikely to change (e.g. Wikipedia). There is a good chance that the old version of this book will be delete once the new one is online. Please remove the target link or change it to something internally.
bildschirmfoto 2015-04-14 um 12 59 30

Lazy loading Database connection

In chapter 4 one of the first examples is to create a Country model. To proof that the model is created one has to type the model name into rails console, like so:

$> Country
My first output was: => Country (call 'Country.connection' to establish a connection)

So i searched the web and discovered that this is a feature that Rails version 4 and upwards is offering.
The connection to the database from the console is only established when needed.

To fix this, you can wether call the suggested Country.connection or simple call a function on this model like Country.count. After that the connection is established and the output is like expected.

My question. Should this behavior reflect in an added article to the book? Maybe a note under this example?

s/0.0.0.0:3000/localhost:3000/g

Using localhost:3000 is a bit better than using 0.0.0.0:3000. On some OSes strange side effects happen and therefor localhost:3000 is preferred.

$ grep "http://0.0.0.0:3000" chapter03-first-steps-with-rails.md
So let's go to the URL <http://0.0.0.0:3000> or <http://localhost:3000>
<http://0.0.0.0:3000/hello-world>:
> <http://0.0.0.0:3000/hello-world.html>. But Rails regards HTML and
<http://0.0.0.0:3000/example/test>:
Visit that page with the URL <http://0.0.0.0:3000/example/test>
If we now go to the URL <http://0.0.0.0:3000/example/test>, we see the 2000:
<http://0.0.0.0:3000/game/ping>? Easy, you will say, we just change the
When we try to go to <http://0.0.0.0:3000/game/ping> we are
automatically redirected to <http://0.0.0.0:3000/game/pong> and in the
Redirected to http://0.0.0.0:3000/game/pong
<http://0.0.0.0:3000/game/ping>. We are redirected from ping to pong.
<http://0.0.0.0:3000/game/ping> in the browser:
If we go to <http://0.0.0.0:3000/game/pong> we still see the normal Pong
page. But if we go to <http://0.0.0.0:3000/game/ping> we are redirected
14:46 $

Fix occurrence of .column_names - "situation" in chapter 4

Book has to be changed to Book.column_names. Same for other occurrences of this functionallity:

$ rails console
Loading development environment (Rails 4.2.1)
>> Book
=> Book(id: integer, title: string, created_at: datetime, updated_at: datetime)
>> Author
=> Author(id: integer, book_id: integer, first_name: string, last_name: string, created_at: datetime, updated_at: datetime)
>> exit
$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.