Folks, I am following Ruby on Rails Tutorial and working on the DemoApp in Chapter 2. My env is :
Win 7
Ruby 1.9.3
Rails 4.0.2
Just did the following:
c:\rails generate scaffold User name:string email:string
I brought the server up using :
c:\rails s
Now when I go try to view the users page on a web browser using the URI:
http://"localhost":3000/users ---> doing "localhost" instead of localhost
I get the error mentioned in the title (Encoding::InvalidByteSequenceError in Users#index).
I am new to rails.
Please help?
thanks
Related
There are Rails 4.1 and 3.2.12 installed on our system (Windows). When generating Rails engine with:
rails plugin new engine --T --mountable --dummy-path=spec/dummy
The engine is generated with Rails 4 by default. Under spec/dummy/config, we notice that it is:
Rails.application.configure do
Instead of in Rails 3.2.12 engine:
Dummy::Application.configure do
It seems that the Dummy is replaced with Rails in Rails 4 engine. Then we changed the gemspec to rails, '~> 3.2.11' and bundle install and replaced Rails.application with Dummy::Application in dummy/config (now it is rails 3.2.12 in gemfile.lock). However there is error when creating sessions under spec/dummy:
rake db:sessions:create
The error is undefined 'configure' or undefined 'migration_error=' even after replacing Rails.application with Dummy::Application. There is not much info about what's new in Rails 4 engine. How to fix this problem?
In a rails project, i add a feature file and step definition try to use capybara+selenium to load an external url,but it can not work? it has no any browser loading behavior,and from the console, it did not request the external url 'http://baidu.com' but 'http://localhost:3000' why, how can check for me,thanks very much!
**env.rb**
require 'cucumber/rails'
require 'capybara/rails'
require 'capybara/cucumber'
require 'selenium/client'
Capybara.current_driver = :selenium
Capybara.default_selector = :css
**setp_definition:**
When /^i visit baidu$/ do
visit('http://www.baidu.com/')
end
Then /^you should see Baidu$/ do
page.should have_content('Baidu')
end
****the infor on the console:****
[31m expected there to be text "Baidu" in "Browse the documentation Rails
Guides Rails API Ruby core Ruby standard library Welcome aboard You鈥檙e riding
Ruby on Rails! About your application鈥檚 environment Getting started Here鈥檚 h
ow to get rolling: Use rails generate to create your models and controllers To s
ee all available options, run it without parameters. Set up a default route and
remove public/index.html Routes are set up in config/routes.rb. Create your data
base Run rake db:create to create your database. If you're not using SQLite (the
default), edit config/database.yml
with your username and password." (RSpec::Ex
pectations::ExpectationNotMetError)[0m.
My app worked a few days ago.
I have switched to 'thin' from webrick
now I get
2011-12-28T07:08:53+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/jquery.livequery-6725741b06c676d9173d5056b277caeb.js"):
I saw on other question that they were told to set this to true
config.serve_static_assets = false
but heroku recommends against that.
I have tried both using rake assets:precompile locally and then pushing and also without it and let heroku precompile.
Both give same error
How do I make sure the javascripts are served, compiled and available?
Why is the error occuring?
I'm using rails 3.1.3 on cedar, Latest Thin.
I was able to solve this using the question Rails 3.1 asset precompilation - include all javascript files
so.. problem solved
I am new to ruby on rails, just trying to follow some tutorials.I just entered:
rails generate controller helloWorld index
then i started rails server and tried to access http://localhost:3000/hello_world/index
and got
Action controller: Exception Caught
ActiveRecord::ConnectionNotEstablished
ActiveRecord::ConnectionNotEstablished
in the browser
Did you run rake db:create db:migrate before starting the server.
If you did, pls check your database configuration in config/database.yml. If you can't figure it out, please let us know the contents of that file.
The question explains itself...
I wanna test a new rails plugin with rspec, are there any specific generators, gems?
I used rails g plugin blabla and I got an error on rspec generator: error rspec [not found].
FYI - there is an open github issue about this: https://github.com/rspec/rspec-rails/issues/#issue/258.