Reputation: 1321
I have looked over my basic starting code to be sure I didn't make a spelling goof. You may see something I did. I cannot get my application.html.erb to appear. My basic app has only one model. I haven't installed a controller and view working the model first via TDD. I installed 'twitter-bootstrap-rails' and followed the install procedure. I did not test the view before installing bootstrap. My ruby is 1.9.3 and my rails app is 3.2.11 Here is my routes.rb
root :to => 'weather#index'
resources :weather
Here is my applicable Gemfile
group :assets do
gem 'sass-rails', '~> 3.2'
#gem 'bootstrap-sass', '~> 2.3.1.0' bailed when it seemed to conflict
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
Here is my controller:
class WeatherController < ActionController::Base
def index
end
end
Here is my views/weather/index.html.erb:
test
My views/layouts/application.html.erb has the twitter-bootstrap-rails layout with a <%= yield %>
I'm aware that my controller is not named the Rails way. When I changed it to weathers in all the appropriate places, the result is the same. I get the word test with NONE of the application html code. The source of the result is just "test" with no html headers or output. If I put layout: 'application' in the index action I get it to appear but not the contents of the index.html.erb. I have looked in SO but they do not seem to apply, or work. Being new at this is an impediment. I'm sure I overlooked something stupid. Thanks for looking, sam
Upvotes: 1
Views: 183
Reputation: 8202
Your controller should be inheriting from ApplicationController not from ActionController::Base
Just referring to my own question on exactly the same problem some time back: Having to explicitly render :layout => 'application' in controller actions in my Rails 3 app
Changing that worked for several people.
Upvotes: 2