I have Ruby24 x64 installed with webdrivers and chromedriver.
In the irb I type
require 'watir'
b = Watir::Browser.new
A Chrome browser is launched. In the irb after about :30 seconds I get an error message: Net::ReadTimeout
I've looked on Stackoverflow and the corners of the Internet. I can not figure out what is causing this.
The whole message:
Net::ReadTimeout: Net::ReadTimeout
from C:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:176:in `rbuf_fill'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:154:in `readuntil'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:164:in `readline'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:40:in `read_status_line'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:29:in `read_new'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1446:in `block in transport_request'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1443:in `catch'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1443:in `transport_request'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1416:in `request'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1409:in `block in request'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:877:in `start'
from C:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1407:in `request'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/
remote/http/default.rb:123:in `response_for'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/
remote/http/default.rb:78:in `request'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/
remote/http/common.rb:61:in `call'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/
remote/bridge.rb:170:in `execute'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/
remote/bridge.rb:103:in `create_session'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/
remote/bridge.rb:54:in `handshake'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/
chrome/driver.rb:58:in `initialize'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/
common/driver.rb:46:in `new'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/
common/driver.rb:46:in `for'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver.
rb:86:in `for'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/watir-6.8.4/lib/watir/browser.rb:48:in `initiali
ze'
from (irb):2:in `new'
from (irb):2
from C:/Ruby24-x64/bin/irb.cmd:19:in `<main>'
I have received a bunch of front end code to integrate with my existing Rails application. The other developer used SCSS, and structured their files like so:
styles/styles.scss
#import "mixins";
#import "1-settings/colors",
"1-settings/fonts",
"1-settings/sizes";
#import "2-generic/reset",
"2-generic/normalize",
"2-generic/structure";
#import "3-base/body",
"3-base/headings";
#import "4-components/buttons",
"4-components/forms",
"4-components/grid",
"4-components/section";
#import "5-objects/banner",
"5-objects/card",
"5-objects/footer",
"5-objects/header",
"5-objects/mobile-nav";
#import "6-pages/404",
"6-pages/about",
"6-pages/application",
"6-pages/dashboard",
"6-pages/home",
"6-pages/profile",
"6-pages/signup",
"6-pages/training";
#import "utility";
In 2-generic/reset, a mixin I defined in my _mixins partial was #included, however I continuously receive the error:
Sass::SyntaxError in Pages#index
Undefined mixin 'vendor'.
app/assets/stylesheets/styles/2-generic/_reset.scss:14:in `vendor'
app/assets/stylesheets/styles/2-generic/_reset.scss:14
sass (3.4.19) lib/sass/tree/visitors/perform.rb:349:in `block in visit_mixin'
sass (3.4.19) lib/sass/stack.rb:98:in `block in with_mixin'
sass (3.4.19) lib/sass/stack.rb:115:in `with_frame'
sass (3.4.19) lib/sass/stack.rb:98:in `with_mixin'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:347:in `visit_mixin'
sass (3.4.19) lib/sass/tree/visitors/base.rb:36:in `visit'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:158:in `block in visit'
sass (3.4.19) lib/sass/stack.rb:79:in `block in with_base'
sass (3.4.19) lib/sass/stack.rb:115:in `with_frame'
sass (3.4.19) lib/sass/stack.rb:79:in `with_base'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:158:in `visit'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:431:in `block (2 levels) in visit_rule'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:431:in `map'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:431:in `block in visit_rule'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:179:in `with_environment'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:429:in `visit_rule'
sass (3.4.19) lib/sass/tree/visitors/base.rb:36:in `visit'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:158:in `block in visit'
sass (3.4.19) lib/sass/stack.rb:79:in `block in with_base'
sass (3.4.19) lib/sass/stack.rb:115:in `with_frame'
sass (3.4.19) lib/sass/stack.rb:79:in `with_base'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:158:in `visit'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:431:in `block (2 levels) in visit_rule'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:431:in `map'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:431:in `block in visit_rule'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:179:in `with_environment'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:429:in `visit_rule'
sass (3.4.19) lib/sass/tree/visitors/base.rb:36:in `visit'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:158:in `block in visit'
sass (3.4.19) lib/sass/stack.rb:79:in `block in with_base'
sass (3.4.19) lib/sass/stack.rb:115:in `with_frame'
sass (3.4.19) lib/sass/stack.rb:79:in `with_base'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:158:in `visit'
sass (3.4.19) lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
sass (3.4.19) lib/sass/tree/visitors/base.rb:52:in `map'
sass (3.4.19) lib/sass/tree/visitors/base.rb:52:in `visit_children'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:179:in `with_environment'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:166:in `visit_children'
sass (3.4.19) lib/sass/tree/visitors/base.rb:36:in `block in visit'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:186:in `visit_root'
sass (3.4.19) lib/sass/tree/visitors/base.rb:36:in `visit'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:157:in `visit'
sass (3.4.19) lib/sass/tree/visitors/perform.rb:8:in `visit'
sass (3.4.19) lib/sass/tree/root_node.rb:36:in `css_tree'
sass (3.4.19) lib/sass/tree/root_node.rb:20:in `render'
sass (3.4.19) lib/sass/engine.rb:278:in `render'
sass-rails (5.0.4) lib/sass/rails/template.rb:47:in `evaluate'
tilt (2.0.1) lib/tilt/template.rb:96:in `render'
sprockets (3.4.0) lib/sprockets/legacy_tilt_processor.rb:25:in `call'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:75:in `call_processor'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:57:in `block in call_processors'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:56:in `reverse_each'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:56:in `call_processors'
sprockets (3.4.0) lib/sprockets/loader.rb:134:in `load_from_unloaded'
sprockets (3.4.0) lib/sprockets/loader.rb:60:in `block in load'
sprockets (3.4.0) lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
sprockets (3.4.0) lib/sprockets/loader.rb:44:in `load'
sprockets (3.4.0) lib/sprockets/cached_environment.rb:20:in `block in initialize'
sprockets (3.4.0) lib/sprockets/cached_environment.rb:47:in `yield'
sprockets (3.4.0) lib/sprockets/cached_environment.rb:47:in `load'
sprockets (3.4.0) lib/sprockets/bundle.rb:23:in `block in call'
sprockets (3.4.0) lib/sprockets/utils.rb:183:in `dfs'
sprockets (3.4.0) lib/sprockets/bundle.rb:24:in `call'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:75:in `call_processor'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:57:in `block in call_processors'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:56:in `reverse_each'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:56:in `call_processors'
sprockets (3.4.0) lib/sprockets/loader.rb:134:in `load_from_unloaded'
sprockets (3.4.0) lib/sprockets/loader.rb:60:in `block in load'
sprockets (3.4.0) lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
sprockets (3.4.0) lib/sprockets/loader.rb:44:in `load'
sprockets (3.4.0) lib/sprockets/cached_environment.rb:20:in `block in initialize'
sprockets (3.4.0) lib/sprockets/cached_environment.rb:47:in `yield'
sprockets (3.4.0) lib/sprockets/cached_environment.rb:47:in `load'
sprockets (3.4.0) lib/sprockets/base.rb:66:in `find_asset'
sprockets (3.4.0) lib/sprockets/environment.rb:30:in `find_asset'
sprockets (3.4.0) lib/sprockets/base.rb:92:in `[]'
sprockets-rails (2.3.3) lib/sprockets/rails/helper.rb:230:in `lookup_asset_for_path'
sprockets-rails (2.3.3) lib/sprockets/rails/helper.rb:190:in `check_errors_for'
sprockets-rails (2.3.3) lib/sprockets/rails/helper.rb:159:in `block in stylesheet_link_tag'
sprockets-rails (2.3.3) lib/sprockets/rails/helper.rb:158:in `map'
sprockets-rails (2.3.3) lib/sprockets/rails/helper.rb:158:in `stylesheet_link_tag'
app/views/layouts/application.html.erb:24:in `_app_views_layouts_application_html_erb___1130277748_57752820'
actionview (4.2.0) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.0) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.0) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.0) lib/action_view/template.rb:143:in `render'
actionview (4.2.0) lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout'
actionview (4.2.0) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
actionview (4.2.0) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (4.2.0) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (4.2.0) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (4.2.0) lib/action_view/rendering.rb:100:in `_render_template'
actionpack (4.2.0) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (4.2.0) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (4.2.0) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
actionpack (4.2.0) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
actionpack (4.2.0) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.2.0) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.2.0) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
C:/Ruby200-x64/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (4.2.0) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.2.0) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (4.2.0) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.2.0) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (4.2.0) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.0) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.0) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:234:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:92:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_process_action_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.2.0) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.0) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.0) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.0) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.2.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.0) lib/action_controller/metal.rb:236:in `block in action'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:42:in `serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:802:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:647:in `call'
activerecord (4.2.0) lib/active_record/migration.rb:378:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_call_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.0) lib/rails/engine.rb:518:in `call'
railties (4.2.0) lib/rails/application.rb:164:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
C:/Ruby200-x64/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
C:/Ruby200-x64/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
I have tried changing the order of everything, moving everything into the same directory, and moving/removing/adding *= requires in the application.css file to no avail.
What am I doing wrong?
EDIT
2-generic/_reset.scss
/*-----------------------------------*\
* generic/reset *
\*-----------------------------------*/
/**
* Apply border box to all elements
*/
* {
&,
&:before,
&:after{
#include vendor(box-sizing, border-box);
}
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-tap-highlight-color: transparent; /* For some Androids */
}
/**
* The usual...
*/
h1,h2,h3,h4,h5,h6,
p,blockquote,pre,
dl,dd,ol,ul,
form,fieldset,legend,
table,th,td,caption,
hr {
margin:0;
padding:0;
}
/**
* Give a help cursor to elements that give extra info on `:hover`.
*/
abbr[title],dfn[title]{
cursor:help;
}
/**
* Remove underlines from potentially troublesome elements.
*/
u,ins {
text-decoration:none;
}
/**
* Apply faux underline via `border-bottom`.
*/
ins {
border-bottom:1px solid;
}
/**
* So that `alt` text is visually offset if images don’t load.
*/
img {
font-style:italic;
max-width: 100%;
max-height: 100%;
}
a img { border: none; }
/**
* Give form elements some cursor interactions...
*/
label,
input,
textarea,
button,
select,
option {
cursor:pointer;
}
.text-input:active,
.text-input:focus,
textarea:active,
textarea:focus{
cursor:text;
outline:none;
}
EDIT 2 _mixins.scss
/*-----------------------------------*\
* tools/mixins *
\*-----------------------------------*/
/**
* Adds vendor specific prefixes for certain CSS3 properties
*/
#mixin vendor($property, $value){
-webkit-#{$property}:$value;
-moz-#{$property}:$value;
-ms-#{$property}:$value;
-o-#{$property}:$value;
#{$property}:$value;
}
/**
* Takes two colors and a direction to create a gradient background
* #include gradient-bg(#FFFFFF, #000000, vertical);
*/
#mixin gradient-bg($color1, $color2, $direction) {
#if ($direction == vertical) {
$end_position: bottom;
$linear_end_position: left bottom;
}
#else if ($direction == horizontal) {
$end_position: right;
$linear_end_position: right top;
}
background-image: -webkit-gradient(linear, left top, $linear_end_position, color-stop(0, $color1), color-stop(1, $color2));
background-image: -o-linear-gradient($end_position, $color1 0%, $color2 100%);
background-image: -moz-linear-gradient($end_position, $color1 0%, $color2 100%);
background-image: -webkit-linear-gradient($end_position, $color1 0%, $color2 100%);
background-image: -ms-linear-gradient($end_position, $color1 0%, $color2 100%);
background-image: linear-gradient(to $end_position, $color1 0%, $color2 100%);
}
/**
* Min-width breakpoint
*/
#mixin bp-min($size) {
#media screen and (min-width: #{$size}) {
#content;
}
}
/**
* Max-width breakpoint
* We use $size - 1 so default sizes can be used. ex. $size--lap instead of 1023
*/
#mixin bp-max($size) {
#media screen and (max-width: #{$size - 1}) {
#content;
}
}
Try moving the mixin you're trying to include to the top of your reset file and see if you still get the error.
Maybe it's a simple mixin definition problem or name misspelling, if it works then you know there's a problem with the imports.
I want to load bootstrap-sprockets from the bootstrap-sass gem in my layout file (e.g. application.html.erb ) and not in the application.scss. Normally it is recommended to put bootstrap and bootstrap-sprockets in the application.scss like this:
#import "bootstrap-sprockets";
#import "bootstrap";
and then load into your application.scss like this:
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
I want to load them like this:
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= stylesheet_link_tag 'bootstrap-sprockets', 'data-turbolinks-track' => true %>
<%= stylesheet_link_tag 'bootstrap', 'data-turbolinks-track' => true %>
such that I can load them as I in the erb based on some application variable. e.g. with bootswatch and a instance variable:
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= stylesheet_link_tag 'bootstrap-sprockets', 'data-turbolinks-track' => true %>
<%= stylesheet_link_tag 'bootswatch/'+ #account.style.name.downcase + '/variables', 'data-turbolinks-track' => true %>
<%= stylesheet_link_tag 'bootstrap', 'data-turbolinks-track' => true %>
Although, I keep getting a RoutingError when loading these assets this way even though I have it in my precompiled assets in assets.rb like this Rails.application.config.assets.precompile += %w( bootstrap-sprockets )
Started GET "/stylesheets/bootstrap-sprockets.css" for 127.0.0.1 at 2015-04-30 13:44:44 -0400
ActionController::RoutingError (No route matches [GET] "/stylesheets/bootstrap-sprockets.css"):
actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
web-console (2.1.2) lib/web_console/middleware.rb:37:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.0) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.0) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.0) lib/rack/lock.rb:17:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.0) lib/rack/sendfile.rb:113:in `call'
railties (4.2.1) lib/rails/engine.rb:518:in `call'
railties (4.2.1) lib/rails/application.rb:164:in `call'
rack (1.6.0) lib/rack/content_length.rb:15:in `call'
thin (1.6.3) lib/thin/connection.rb:86:in `block in pre_process'
thin (1.6.3) lib/thin/connection.rb:84:in `catch'
thin (1.6.3) lib/thin/connection.rb:84:in `pre_process'
thin (1.6.3) lib/thin/connection.rb:53:in `process'
thin (1.6.3) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.7) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.7) lib/eventmachine.rb:187:in `run'
thin (1.6.3) lib/thin/backends/base.rb:73:in `start'
thin (1.6.3) lib/thin/server.rb:162:in `start'
rack (1.6.0) lib/rack/handler/thin.rb:19:in `run'
rack (1.6.0) lib/rack/server.rb:286:in `start'
railties (4.2.1) lib/rails/commands/server.rb:80:in `start'
railties (4.2.1) lib/rails/commands/commands_tasks.rb:80:in `block in server'
railties (4.2.1) lib/rails/commands/commands_tasks.rb:75:in `tap'
railties (4.2.1) lib/rails/commands/commands_tasks.rb:75:in `server'
railties (4.2.1) lib/rails/commands/commands_tasks.rb:39:in `run_command!'
railties (4.2.1) lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:8:in `require'
bin/rails:8:in `<top (required)>'
spring (1.3.4) lib/spring/client/rails.rb:28:in `load'
spring (1.3.4) lib/spring/client/rails.rb:28:in `call'
spring (1.3.4) lib/spring/client/command.rb:7:in `call'
spring (1.3.4) lib/spring/client.rb:26:in `run'
spring (1.3.4) bin/spring:48:in `<top (required)>'
spring (1.3.4) lib/spring/binstub.rb:11:in `load'
spring (1.3.4) lib/spring/binstub.rb:11:in `<top (required)>'
/Users/cj/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/cj/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
How do I get these assets to load properly from the gem?
please check which file extention do you use may be you use yourFileName.css but link goes to yourFileName.scss or .sass
also check is your Gemfile has
gem 'bootstrap-sass'
may be also this links will be usefull for you
https://github.com/twbs/bootstrap-sass/issues/692#issuecomment-55091209
http://www.gotealeaf.com/blog/integrating-rails-and-bootstrap-part-1
good luck
When I run rails s -e production it works fine but when I go to view the page the css is not being loaded. I've made sure to add config.assets.precompile += %w( crowdcode.css ) to production.rb and ran the command RAILS_ENV=production bundle exec rake assets:precompile before starting the server. I've been stuck on this and am not sure what to do.
Also the not_found template exists.
Here is what the server is logging.
Started GET "/" for 127.0.0.1 at 2013-08-29 17:36:26 +0000
Processing by ReviewsController#index as HTML
Rendered reviews/index.html.erb within layouts/application (33.9ms)
Rendered shared/_header.html.erb (2.3ms)
Completed 200 OK in 89ms (Views: 87.1ms | ActiveRecord: 1.5ms | Solr: 0.0ms)
Started GET "/assets/crowdcode-c312d7630b6588b5a99f361e3fab64bc.css" for 127.0.0.1 at 2013-08-29 17:36:26 +0000
Processing by StaticController#not_found as CSS
Parameters: {"a"=>"assets/crowdcode-c312d7630b6588b5a99f361e3fab64bc"}
Completed 500 Internal Server Error in 36ms
ActionView::MissingTemplate (Missing template static/not_found, application/not_found with {:locale=>[:en], :formats=>[:css], :handlers=>[:erb, :builder]}. Searched in:
* "/home/ubuntu/Git/crowdcode/app/views"
):
actionpack (3.2.11) lib/action_view/path_set.rb:58:in `find'
actionpack (3.2.11) lib/action_view/lookup_context.rb:109:in `find'
actionpack (3.2.11) lib/action_view/renderer/abstract_renderer.rb:3:in `find_template'
actionpack (3.2.11) lib/action_view/renderer/template_renderer.rb:34:in `determine_template'
actionpack (3.2.11) lib/action_view/renderer/template_renderer.rb:10:in `render'
actionpack (3.2.11) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.11) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.11) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.11) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.11) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.11) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.11) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/home/ubuntu/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.11) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.11) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
sunspot_rails (2.0.0) lib/sunspot/rails/railties/controller_runtime.rb:15:in `cleanup_view_runtime'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.11) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.11) lib/active_support/callbacks.rb:414:in `_run__92929331906777610__process_action__4197991901307476159__callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.11) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.11) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.11) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.11) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.11) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.11) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.11) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.11) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:601:in `call'
omniauth (1.1.3) lib/omniauth/strategy.rb:177:in `call!'
omniauth (1.1.3) lib/omniauth/strategy.rb:157:in `call'
omniauth (1.1.3) lib/omniauth/builder.rb:48:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.11) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `_run__3633207603625577106__call__2599388094366383915__callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.11) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.11) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.11) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.11) lib/rails/engine.rb:479:in `call'
railties (3.2.11) lib/rails/application.rb:223:in `call'
railties (3.2.11) lib/rails/railtie/configurable.rb:30:in `method_missing'
rack (1.4.5) lib/rack/deflater.rb:13:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.11) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
thin (1.5.1) lib/thin/connection.rb:79:in `catch'
thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
thin (1.5.1) lib/thin/connection.rb:54:in `process'
thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
thin (1.5.1) lib/thin/server.rb:159:in `start'
rack (1.4.5) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.5) lib/rack/server.rb:268:in `start'
railties (3.2.11) lib/rails/commands/server.rb:70:in `start'
railties (3.2.11) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.11) lib/rails/commands.rb:50:in `tap'
railties (3.2.11) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Started GET "/assets/application-3e6c78ba3d0dce5818d812e2b87a8a7f.js" for 127.0.0.1 at 2013-08-29 17:36:26 +0000
Processing by StaticController#not_found as JS
Parameters: {"a"=>"assets/application-3e6c78ba3d0dce5818d812e2b87a8a7f"}
Rendered static/not_found.html.erb within layouts/application (0.4ms)
Rendered shared/_header.html.erb (1.2ms)
Completed 200 OK in 5ms (Views: 4.4ms | ActiveRecord: 0.0ms | Solr: 0.0ms)
Started GET "/" for 127.0.0.1 at 2013-08-29 17:36:28 +0000
Processing by ReviewsController#index as HTML
Rendered reviews/index.html.erb within layouts/application (1.9ms)
Rendered shared/_header.html.erb (1.1ms)
Completed 200 OK in 6ms (Views: 4.6ms | ActiveRecord: 0.5ms | Solr: 0.0ms)
Started GET "/assets/crowdcode-c312d7630b6588b5a99f361e3fab64bc.css" for 127.0.0.1 at 2013-08-29 17:36:28 +0000
Processing by StaticController#not_found as CSS
Parameters: {"a"=>"assets/crowdcode-c312d7630b6588b5a99f361e3fab64bc"}
Completed 500 Internal Server Error in 1ms
Have you tried changing the file config/production.rb
from:
config.serve_static_assets = false
to:
config.serve_static_assets = true
This may fix your issue and after this don't forget to precomplie your assets.
Hope this should work. :-)
I have a simple sinatra-activerecord app. Inside the file ./config/environments.rb I have the following configurations:
configure :development, :test do
set :database, 'sqlite://database.db'
end
# These Heroku setup instructions can be at: https://devcenter.heroku.com/articles/rack
configure :production do
# Database connection
db = URI.parse(ENV['DATABASE_URL'] || 'postgres://localhost/mydb')
ActiveRecord::Base.establish_connection(
:adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme,
:host => db.host,
:username => db.user,
:password => db.password,
:database => db.path[1..-1],
:encoding => 'utf8'
)
end
When I push to Heroku, the DB setup works just fine. However, locally, it doesn't. For example, if I do
$ rake db:migrate
I get the following fine output:
== CreateHotels: migrating ===================================================
-- create_table(:hotels)
-> 0.0015s
-- add_index(:hotels, :hotel_name)
-> 0.0004s
== CreateHotels: migrated (0.0021s) ==========================================
Now, if I start the server and use curl to make a call:
$ shotgun app.rb
$ curl -d "hotel_name=Sheraton" http://127.0.0.1:9393/hotels/
I get the following error:
ActiveRecord::StatementInvalid - Could not find table 'hotels':
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:472:in `table_structure'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:346:in `columns'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.8/lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `yield'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `default'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `columns'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:243:in `column_defaults'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.8/lib/active_record/base.rb:482:in `initialize'
/Users/Sy/Developer/Sinatra/stay-checkin-api/routes/hotels_routes.rb:8:in `new'
/Users/Sy/Developer/Sinatra/stay-checkin-api/routes/hotels_routes.rb:8:in `block in <top (required)>'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in `block in compile!'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `[]'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `block (3 levels) in route!'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:851:in `route_eval'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `block (2 levels) in route!'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:872:in `block in process_route'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:in `catch'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:in `process_route'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:834:in `block in route!'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:833:in `each'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:833:in `route!'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:936:in `dispatch!'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `block in call!'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `block in invoke'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `catch'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `invoke'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `call!'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:755:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-protection-1.2.0/lib/rack/protection/json_csrf.rb:17:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-protection-1.2.0/lib/rack/protection/base.rb:47:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/nulllogger.rb:9:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/head.rb:9:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/showexceptions.rb:21:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:99:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:in `block in call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:1471:in `synchronize'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/lint.rb:48:in `_call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/lint.rb:36:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/showexceptions.rb:24:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/commonlogger.rb:20:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.3/lib/sinatra/base.rb:136:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/shotgun-0.9/lib/shotgun/loader.rb:86:in `proceed_as_child'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/shotgun-0.9/lib/shotgun/loader.rb:31:in `call!'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/shotgun-0.9/lib/shotgun/loader.rb:18:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/shotgun-0.9/lib/shotgun/favicon.rb:12:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/builder.rb:134:in `call'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.4.1/lib/thin/connection.rb:80:in `block in pre_process'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.4.1/lib/thin/connection.rb:78:in `catch'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.4.1/lib/thin/connection.rb:78:in `pre_process'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.4.1/lib/thin/connection.rb:53:in `process'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.4.1/lib/thin/connection.rb:38:in `receive_data'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.4.1/lib/thin/backends/base.rb:63:in `start'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.4.1/lib/thin/server.rb:159:in `start'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:in `run'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/gems/shotgun-0.9/bin/shotgun:156:in `<top (required)>'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/bin/shotgun:19:in `load'
/Users/Sy/.rvm/gems/ruby-1.9.3-p125/bin/shotgun:19:in `<main>'
Any idea?
ps: here are my app.rb, config.rb, routes, and model file.
app.rb
require 'sinatra'
require 'sinatra/activerecord'
require 'uri'
require './config/environments'
require_relative 'models/init'
require_relative 'routes/init'
config.rb
require './app'
run Sinatra::Application
model: hotel.rb
class Hotel < ActiveRecord::Base
validates :hotel_name, :presence => true
end
routes: hotels_routes.rb
get '/hotels' do
#hotels = Hotel.all
if #hotels
content_type :json
#hotels.to_json
end
end
post '/hotels/' do
#hotel = Hotel.new
#hotel.hotel_name = params[:hotel_name]
if #hotel.save
content_type :json
#hotel.to_json
else
content_type :json
"Failed to create new hotel with name #{params[:hotel_name]}".to_json
end
end
Gemfile
source :rubygems
gem 'heroku'
gem 'sinatra'
gem 'thin'
gem 'activerecord'
gem 'sinatra-activerecord'
gem 'json'
# Define which database gem to use depending on whether you are in local or production environment
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg' # this gem is required to use postgres on Heroku
end
Rakefile
require './app'
require 'sinatra/activerecord/rake'
The database set is wrong, try:
set :database, 'sqlite:///database.db'