On Aug 31, 2012, at 2:49 PM, 7stud -- wrote:

> 1) Yes, the page shows when I start rails server, and then use the url:
> 
> http://localhost:300/static_pages/home
> 
> 2) Everything in public/ was created by rails new:
> 
> $ ls public/
> 404.html  500.html  index.html
> 422.html  favicon.ico  robots.txt
> 
> 
> 3) test.log:
> 
> Started GET "/static_pages/home" for 127.0.0.1 at 2012-08-31 10:04:28
> -0700
> Processing by StaticPagesController#home as HTML
>  Rendered static_pages/home.html.erb within layouts/application (3.7ms)
> Completed 200 OK in 21ms (Views: 20.0ms | ActiveRecord: 0.0ms)
>  [1m[35m (0.1ms)[0m  rollback transaction
>  [1m[36m (0.1ms)[0m  [1mbegin transaction[0m
> 
> 
> Started GET "/static_pages/home" for 127.0.0.1 at 2012-08-31 10:04:28
> -0700
> Processing by StaticPagesController#home as HTML
> Completed 200 OK in 2ms (Views: 1.6ms | ActiveRecord: 0.0ms)
>  [1m[35m (0.1ms)[0m  rollback transaction
>  [1m[36m (0.1ms)[0m  [1mbegin transaction[0m
> 
> 
> 
> Yet here is my controller:
> 
> class StaticPagesController < ApplicationController
> end
> 
> Previously, I had actions in my controller, but I wanted to see if the
> tests would fail without the actions, and I fully expected them to fail,
> but they won't.  I have everything at github:
> 
> https://github.com/7stud/sample_app25
> 
> Curiously, if I write a test for a non-existent view, I get three
> errors:  First, no route; then after I add the route:
> 
> get '/static_pages/something'
> 
> I get an error saying there's no action; then after I add the action, I
> get an error saying there's no view; then after adding a view, the test
> passes.  Subsequently, if I delete the action for that view, the test
> still passes.  Why?

What's in your routes.rb? This could be a catch-all route firing. In Ryan 
Bates' Railscast on semi-static pages, he mentions that a completely empty 
controller will work as long as there is a properly named view file at the 
expected path. I tried it in a quick test app, but it didn't work in vanilla 
3.2.

Walter

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to