I have looked at the answers below and even after running compass compile I still get the error below.
I have installed all required gems but I keep getting the error.
What would be the best way to import fonts using the SASS workflow, any guidance would be greatly appreciated.
My Config.rb file
add_import_path "bower_components/foundation/scss"
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
javascripts_dir = "js"
output_style = :compressed
My Gruntfile
/*jslint node: true */
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
includePaths: ['bower_components/foundation/scss']
},
dist: {
options: {
outputStyle: 'compressed',
sourceMap: false,
},
files: {
'css/app.css': 'sass/app.scss'
}
}
}, // sass
compass: {
dev: {
options: {
config: 'config.rb'
}
} // dev
}, //compass
watch: {
options: {
livereload: true,
dateFormat: function(time) {
grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
grunt.log.writeln('Waiting for more changes...');
} //date format function
}, //options
scripts: {
files: ['*.js']
}, // scripts
//Live Reload of SASS
sass: {
files: 'sass/**/*.scss',
tasks: ['sass']
}, //sass
css: {
files: ['sass/*.scss'],
tasks: ['compass']
},
html: {
files: ['*.html']
}
} //watch
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.registerTask('build', ['sass', 'compass']);
grunt.registerTask('default', ['build', 'watch']);
}
My Gems
actionpack (4.2.3)
actionview (4.2.3)
activesupport (4.2.3)
bigdecimal (1.2.0)
builder (3.2.2)
bundler (1.10.5)
CFPropertyList (2.2.8)
chunky_png (1.3.4, 1.3.3)
compass (1.0.3)
compass-core (1.0.3)
compass-import-once (1.0.5)
compass-rails (2.0.4)
erubis (2.7.0)
ffi (1.9.10)
foundation (1.0.4)
fssm (0.2.10)
hike (1.2.3)
i18n (0.7.0)
io-console (0.4.2)
json (1.7.7)
libxml-ruby (2.6.0)
loofah (2.0.2)
mini_portile (0.6.2)
minitest (5.7.0, 4.3.2)
multi_json (1.11.2)
nokogiri (1.6.6.2)
psych (2.0.0)
rack (1.6.4)
rack-test (0.6.3)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.6)
rails-html-sanitizer (1.0.2)
railties (4.2.3)
rake (0.9.6)
rb-fsevent (0.9.5)
rb-inotify (0.9.5)
rdoc (4.0.0)
sass (3.4.16)
sass-rails (5.0.1)
sprockets (2.12.4)
sprockets-rails (2.3.2)
sqlite3 (1.3.7)
susy (2.2.2)
test-unit (2.0.0.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
tzinfo (1.2.2)
Related
I'm copying and pasting the code from the Ruby Quickstart and combining it with the create-events code sample from here.
The only things I changed were:
the SCOPE from Google::Apis::CalendarV3::AUTH_CALENDAR_READONLY to Google::Apis::CalendarV3::AUTH_CALENDAR_READ
from client to service in the call to .insert_event('primary', event)
Despite this, I'm getting the error:
.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/representable-3.0.4/lib/representable/pipeline.rb:38:in `call': undefined method `each_with_index' for nil:NilClass (NoMethodError)
This is befuddling, none more so than knowing it was working earlier. Is there something obviously wrong in the example that I'm not catching? Or did representable or the api-client cop out all of a sudden?
Are folks able to reproduce the problem? Here's my code along with my Gemfile.lock
require "google/apis/calendar_v3"
require "googleauth"
require "googleauth/stores/file_token_store"
require "date"
require "fileutils"
OOB_URI = "urn:ietf:wg:oauth:2.0:oob".freeze
APPLICATION_NAME = "Google Calendar API Ruby Quickstart".freeze
CREDENTIALS_PATH = "credentials.json".freeze
# The file token.yaml stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
TOKEN_PATH = "token.yaml".freeze
SCOPE = Google::Apis::CalendarV3::AUTH_CALENDAR
##
# Ensure valid credentials, either by restoring from the saved credentials
# files or intitiating an OAuth2 authorization. If authorization is required,
# the user's default browser will be launched to approve the request.
#
# #return [Google::Auth::UserRefreshCredentials] OAuth2 credentials
def authorize
client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH
token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH
authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store
user_id = "default"
credentials = authorizer.get_credentials user_id
if credentials.nil?
url = authorizer.get_authorization_url base_url: OOB_URI
puts "Open the following URL in the browser and enter the " \
"resulting code after authorization:\n" + url
code = gets
credentials = authorizer.get_and_store_credentials_from_code(
user_id: user_id, code: code, base_url: OOB_URI
)
end
credentials
end
# Initialize the API
service = Google::Apis::CalendarV3::CalendarService.new
service.client_options.application_name = APPLICATION_NAME
service.authorization = authorize
event = Google::Apis::CalendarV3::Event.new(
summary: 'Google I/O 2015',
location: '800 Howard St., San Francisco, CA 94103',
description: 'A chance to hear more about Google\'s developer products.',
start: Google::Apis::CalendarV3::EventDateTime.new(
date_time: '2015-05-28T09:00:00-07:00',
time_zone: 'America/Los_Angeles'
),
end: Google::Apis::CalendarV3::EventDateTime.new(
date_time: '2015-05-28T17:00:00-07:00',
time_zone: 'America/Los_Angeles'
),
recurrence: [
'RRULE:FREQ=DAILY;COUNT=2'
],
attendees: [
Google::Apis::CalendarV3::EventAttendee.new(
email: 'lpage#example.com'
),
Google::Apis::CalendarV3::EventAttendee.new(
email: 'sbrin#example.com'
)
],
reminders: Google::Apis::CalendarV3::Event::Reminders.new(
use_default: false,
overrides: [
Google::Apis::CalendarV3::EventReminder.new(
reminder_method: 'email',
minutes: 24 * 60
),
Google::Apis::CalendarV3::EventReminder.new(
reminder_method: 'popup',
minutes: 10
)
]
)
)
result = service.insert_event('primary', event)
puts "Event created: #{result.html_link}"
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
concurrent-ruby (1.1.8)
declarative (0.0.20)
declarative-option (0.1.1)
faraday (1.3.0)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords
faraday-net_http (1.0.1)
gems (1.2.0)
google-api-client (0.53.0)
google-apis-core (~> 0.1)
google-apis-generator (~> 0.1)
google-apis-core (0.3.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.14)
httpclient (>= 2.8.1, < 3.0)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
rexml
signet (~> 0.14)
webrick
google-apis-discovery_v1 (0.2.0)
google-apis-core (~> 0.1)
google-apis-generator (0.2.0)
activesupport (>= 5.0)
gems (~> 1.2)
google-apis-core (~> 0.1)
google-apis-discovery_v1 (~> 0.0)
thor (>= 0.20, < 2.a)
googleauth (0.16.0)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (~> 0.14)
httpclient (2.8.3)
i18n (1.8.9)
concurrent-ruby (~> 1.0)
jwt (2.2.2)
memoist (0.16.2)
mini_mime (1.0.2)
minitest (5.14.4)
multi_json (1.15.0)
multipart-post (2.1.1)
os (1.1.1)
public_suffix (4.0.6)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.4)
ruby2_keywords (0.0.4)
signet (0.15.0)
addressable (~> 2.3)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
thor (1.1.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uber (0.1.0)
webrick (1.7.0)
zeitwerk (2.4.2)
PLATFORMS
ruby
DEPENDENCIES
google-api-client
BUNDLED WITH
2.1.4
so we have the same issue with google storage api after they updated it to 1.31. So we downgraded it to 1.29.1. Please, try to downgrade your version too, it will problably work!
And we needed to clear our heroku cache and reinstall all the gems again.
https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache
Hope it helps
I am trying to include an editor in an Active Admin setting.
I am able to bundle install every version of it up to 1.1.0, but when I run rails s and try to access the admin page I get the following error:
Sass::SyntaxError in Admin/keywords#index
Showing /Users/xxxxx/.rvm/gems/xxxxx/gems/activeadmin-0.6.0/app/views/active_admin/resource/index.html.arb where line #1 raised:
File to import not found or unreadable: ../functions/linear-gradient.
Load path: Sass::Rails::Importer(/Users/xxxxx/.rvm/gems/xxxxx/gems/active_admin_editor-1.0.5/app/assets/stylesheets/active_admin/editor.css.scss)
(in /Users/xxxxx/.rvm/gems/xxxxx/gems/active_admin_editor-1.0.5/app/assets/stylesheets/active_admin/editor.css.scss)
ActionView::Template::Error (File to import not found or unreadable: ../functions/linear-gradient.
Load path: Sass::Rails::Importer(/Users/xxxx/.rvm/gems/xxxx/gems/active_admin_editor-1.0.5/app/assets/stylesheets/active_admin/editor.css.scss)
(in /Users/xxxx/.rvm/gems/xxxx/gems/active_admin_editor-1.0.5/app/assets/stylesheets/active_admin/editor.css.scss)):
1: insert_tag renderer_for(:index)
bourbon (1.0.4) app/assets/stylesheets/css3/_background-image.scss:5
bourbon (1.0.4) app/assets/stylesheets/_bourbon.scss:9
activeadmin (0.6.0) app/assets/stylesheets/active_admin/mixins/_all.css.scss:11
activeadmin (0.6.0) app/assets/stylesheets/active_admin/_mixins.css.scss:1
active_admin_editor (1.0.5) app/assets/stylesheets/active_admin/editor.css.scss:1
sass (3.1.10) lib/sass/./sass/tree/import_node.rb:64:in `import'
sass (3.1.10) lib/sass/./sass/tree/import_node.rb:25:in `imported_file'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:147:in `visit_import'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `send'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:18:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:144:in `visit_import'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:144:in `map'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:144:in `visit_import'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `send'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:18:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:144:in `visit_import'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:144:in `map'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:144:in `visit_import'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `send'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:18:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:144:in `visit_import'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:144:in `map'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:144:in `visit_import'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `send'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:18:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:53:in `visit_children'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:53:in `map'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:53:in `visit_children'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:27:in `visit_children'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:39:in `with_environment'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:26:in `visit_children'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:47:in `visit_root'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `send'
sass (3.1.10) lib/sass/./sass/tree/visitors/base.rb:37:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:18:in `visit'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:7:in `send'
sass (3.1.10) lib/sass/./sass/tree/visitors/perform.rb:7:in `visit'
sass (3.1.10) lib/sass/./sass/tree/root_node.rb:20:in `render'
sass (3.1.10) lib/sass/./sass/engine.rb:300:in `_render'
sass (3.1.10) lib/sass/./sass/engine.rb:247:in `render'
sass-rails (3.2.6) lib/sass/rails/template_handlers.rb:106:in `evaluate'
tilt (1.4.1) lib/tilt/template.rb:103:in `render'
sprockets (2.1.4) lib/sprockets/context.rb:177:in `evaluate'
sprockets (2.1.4) lib/sprockets/context.rb:174:in `each'
sprockets (2.1.4) lib/sprockets/context.rb:174:in `evaluate'
sprockets (2.1.4) lib/sprockets/processed_asset.rb:12:in `initialize'
sprockets (2.1.4) lib/sprockets/base.rb:241:in `new'
sprockets (2.1.4) lib/sprockets/base.rb:241:in `build_asset'
sprockets (2.1.4) lib/sprockets/base.rb:262:in `circular_call_protection'
sprockets (2.1.4) lib/sprockets/base.rb:240:in `build_asset'
sprockets (2.1.4) lib/sprockets/index.rb:89:in `build_asset'
sprockets (2.1.4) lib/sprockets/caching.rb:19:in `cache_asset'
sprockets (2.1.4) lib/sprockets/index.rb:88:in `build_asset'
sprockets (2.1.4) lib/sprockets/base.rb:163:in `find_asset'
sprockets (2.1.4) lib/sprockets/index.rb:56:in `find_asset'
sprockets (2.1.4) lib/sprockets/bundled_asset.rb:16:in `initialize'
sprockets (2.1.4) lib/sprockets/base.rb:244:in `new'
sprockets (2.1.4) lib/sprockets/base.rb:244:in `build_asset'
sprockets (2.1.4) lib/sprockets/index.rb:89:in `build_asset'
sprockets (2.1.4) lib/sprockets/caching.rb:19:in `cache_asset'
sprockets (2.1.4) lib/sprockets/index.rb:88:in `build_asset'
sprockets (2.1.4) lib/sprockets/base.rb:163:in `find_asset'
sprockets (2.1.4) lib/sprockets/index.rb:56:in `find_asset'
sprockets (2.1.4) lib/sprockets/environment.rb:74:in `find_asset'
sprockets (2.1.4) lib/sprockets/base.rb:171:in `[]'
actionpack (3.2.5) lib/sprockets/helpers/rails_helper.rb:126:in `asset_for'
actionpack (3.2.5) lib/sprockets/helpers/rails_helper.rb:44:in `stylesheet_link_tag'
actionpack (3.2.5) lib/sprockets/helpers/rails_helper.rb:43:in `collect'
actionpack (3.2.5) lib/sprockets/helpers/rails_helper.rb:43:in `stylesheet_link_tag'
arbre (1.0.1) lib/arbre/element.rb:175:in `send'
arbre (1.0.1) lib/arbre/element.rb:175:in `method_missing'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:27:in `build_active_admin_head'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:26:in `each'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:26:in `build_active_admin_head'
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:49:in `within'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:24:in `build_active_admin_head'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:9:in `build'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:30:in `build_tag'
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
activeadmin (0.6.0) app/views/active_admin/resource/index.html.arb:1:in `___sers__tephan__rvm_gems_ruby_______p____saftzine_gems_activeadmin_______app_views_active_admin_resource_index_html_arb___381976998_2302642480'
arbre (1.0.1) lib/arbre/context.rb:45:in `instance_eval'
arbre (1.0.1) lib/arbre/context.rb:45:in `initialize'
activeadmin (0.6.0) app/views/active_admin/resource/index.html.arb:1:in `new'
activeadmin (0.6.0) app/views/active_admin/resource/index.html.arb:1:in `___sers__tephan__rvm_gems_ruby_______p____saftzine_gems_activeadmin_______app_views_active_admin_resource_index_html_arb___381976998_2302642480'
actionpack (3.2.5) lib/action_view/template.rb:145:in `send'
actionpack (3.2.5) lib/action_view/template.rb:145:in `render'
activesupport (3.2.5) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.5) lib/action_view/template.rb:143:in `render'
.
.
.
The active-admin.css.scss is:
// SASS variable overrides must be declared before loading up Active Admin's styles.
//
// To view the variables that Active Admin provides, take a look at
// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the
// Active Admin source.
//
// For example, to change the sidebar width:
// $sidebar-width: 242px;
// Active Admin's got SASS!
#import "active_admin/mixins";
#import "active_admin/base";
// Overriding any non-variable SASS must be done after the fact.
// For example, to change the default status-tag color:
//
// body.active_admin {
// .status_tag { background: #6090DB; }
// }
//
// Notice that Active Admin CSS rules are nested within a
// 'body.active_admin' selector to prevent conflicts with
// other pages in the app. It is best to wrap your changes in a
// namespace so they are properly recognized. You have options
// if you e.g. want different styles for different namespaces:
//
// .active_admin applies to any Active Admin namespace
// .admin_namespace applies to the admin namespace (eg: /admin)
// .other_namespace applies to a custom namespace named other (eg: /other)
//= require active_admin/editor/wysiwyg
The only place I can find linear-gradient is in
Searching 482 files for "linear-gradient"
/Users/xxxxx/.rvm/gems/xxxxx/gems/activeadmin-0.6.0/app/assets/stylesheets/active_admin/mixins/_gradients.css.scss:
$secondary-gradient-start: #efefef !default;
$secondary-gradient-stop: #dfe1e2 !default;
#mixin gradient($start, $end){
background: $start;
background: -webkit-linear-gradient(-90deg, $start, $end);
background: -moz-linear-gradient(-90deg, $start, $end);
background: linear-gradient(-90deg, $start, $end);
// IE 6 & 7
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start)}', endColorstr='#{ie-hex-str($end)}');
// IE 8
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start)}', endColorstr='#{ie-hex-str($end)}');
}
#mixin primary-gradient {
#include gradient(lighten($primary-color, 5%), darken($primary-color, 7%));
border-bottom: 1px solid darken($primary-color, 11%);
}
#mixin secondary-gradient {
#include gradient($secondary-gradient-start, $secondary-gradient-stop);
}
#mixin highlight-gradient {
#include gradient(#75a1c2, #608cb4);
}
#mixin reverse-highlight-gradient {
#include gradient(#608cb4, #75a1c2);
}
#mixin no-gradient {
background: none;
// IE 6 & 7
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
// IE 8
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)";
}
active_admin_editor-1.0.x/app/assets/stylesheets/active_admin/editor.css.scss starts with:
#import 'active_admin/mixins';
body form .html_editor {
.wrap {
width: 76%;
float: left;
}
.
.
.
Where am I missing something. How can I get this to work?
My guess is it is related to the removal of Bourbon or the removal of sass-rails. Re-adding one or both may resolve the issue.
Thanks to Piers C and some research on the AA GitHub I was able to find a solution to my problem.
The problem might be related to either Bourbon, SASS or the assets pipeline.
In my case I ended up
deleting #import "bourbon"; from
activeadmin-0.6.0/app/assets/stylesheets/mixins/_all.css.scss
adding a _box_shadow.css.scss mixin in the same folder and
importing it in _all.css.scss
editing the _gradient.css.scss mixin in AA
Now I have the following files:
activeadmin-0.6.0/app/assets/stylesheets/mixins/_all.css.scss
#import "active_admin/mixins/variables";
#import "active_admin/mixins/reset";
#import "active_admin/mixins/gradients";
#import "active_admin/mixins/shadows";
#import "active_admin/mixins/icons";
#import "active_admin/mixins/rounded";
#import "active_admin/mixins/buttons";
#import "active_admin/mixins/sections";
#import "active_admin/mixins/utilities";
#import "active_admin/mixins/typography";
#import "active_admin/mixins/box_shadow";
activeadmin-0.6.0/app/assets/stylesheets/mixins/_box_shadow.css.scss
#mixin box-shadow ($shadow-1,
$shadow-2: false, $shadow-3: false,
$shadow-4: false, $shadow-5: false,
$shadow-6: false, $shadow-7: false,
$shadow-8: false, $shadow-9: false)
{
$full: compact($shadow-1, $shadow-2, $shadow-3, $shadow-4,
$shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9);
-webkit-box-shadow: $full;
-moz-box-shadow: $full;
-ms-box-shadow: $full;
-o-box-shadow: $full;
box-shadow: $full;
}
activeadmin-0.6.0/app/assets/stylesheets/mixins/_gradient.css.scss
$secondary-gradient-start: #efefef !default;
$secondary-gradient-stop: #dfe1e2 !default;
#mixin gradient($start, $end) {
background-color: $start;
background-image: unquote("linear-gradient(180deg, #{$start}, #{$end})");
}
#mixin primary-gradient {
#include gradient(lighten($primary-color, 5%), darken($primary-color, 7%));
border-bottom: 1px solid darken($primary-color, 11%);
}
#mixin secondary-gradient {
#include gradient($secondary-gradient-start, $secondary-gradient-stop);
}
#mixin highlight-gradient {
#include gradient(#75a1c2, #608cb4);
}
#mixin reverse-highlight-gradient {
#include gradient(#608cb4, #75a1c2);
}
#mixin no-gradient {
background-color: none;
}
I mention step three just for completeness, since I discovered later that I did not replicate this step in production, but that everything was working nevertheless.
I have a Sinatra app and am using Padrino. When I use the content_for helper to render content within a layout it returns it as a string instead of html.
app.rb
class CateringApp < Sinatra::Application
register Padrino::Helpers
end
layout.erb
<div id="page-wrapper">
<%= flash[:notice] %>
<%= content_for?(:main_table) ? yield_content(:main_table) : yield %>
</div>
category.erb
<% content_for :main_table do %>
<div id="name" class="row">
"IM ALIVE"
</div>
<% end %>
and the result I'm getting on my browser is the literal string
<div id="name" class="row">
"IM ALIVE"
</div>
app.rb
require 'dotenv'
Dotenv.load
require 'sinatra'
require 'sinatra/activerecord'
require 'sinatra/reloader'
require 'sinatra/flash'
require 'sinatra/assetpack'
require 'padrino-helpers'
class CateringApp < Sinatra::Application
enable :protect_from_csrf
use Rack::Session::Cookie, :secret => ENV['SESSION_SECRET']
register Padrino::Helpers
register Sinatra::AssetPack
end
# require all config files
Dir["./config/*.rb"].each {|file| require file }
require './auth'
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
activemodel (4.1.6)
activesupport (= 4.1.6)
builder (~> 3.1)
activerecord (4.1.6)
activemodel (= 4.1.6)
activesupport (= 4.1.6)
arel (~> 5.0.0)
activesupport (4.1.6)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
backports (3.6.0)
builder (3.2.2)
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
dotenv (0.11.1)
dotenv-deployment (~> 0.0.2)
dotenv-deployment (0.0.2)
excon (0.39.6)
fog (1.23.0)
fog-brightbox
fog-core (~> 1.23)
fog-json
fog-softlayer
ipaddress (~> 0.5)
nokogiri (~> 1.5, >= 1.5.11)
fog-brightbox (0.5.1)
fog-core (~> 1.22)
fog-json
inflecto
fog-core (1.24.0)
builder
excon (~> 0.38)
formatador (~> 0.2)
mime-types
net-scp (~> 1.1)
net-ssh (>= 2.1.3)
fog-json (1.0.0)
multi_json (~> 1.0)
fog-softlayer (0.3.19)
fog-core
fog-json
formatador (0.2.5)
i18n (0.6.11)
inflecto (0.0.2)
ipaddress (0.8.0)
jsmin (1.0.1)
json (1.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
mini_portile (0.6.0)
minitest (5.4.1)
multi_json (1.10.1)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.1)
nokogiri (1.6.3.1)
mini_portile (= 0.6.0)
padrino-helpers (0.12.3)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.12.3)
tilt (~> 1.4.1)
padrino-support (0.12.3)
activesupport (>= 3.1)
pg (0.17.1)
polyglot (0.3.5)
pony (1.11)
mail (>= 2.0)
rack (1.5.2)
rack-protection (1.5.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
sinatra-activerecord (2.0.2)
activerecord (>= 3.2)
sinatra (~> 1.0)
sinatra-assetpack (0.3.3)
jsmin
rack-test
sinatra
tilt (>= 1.3.0, < 2.0)
sinatra-contrib (1.4.2)
backports (>= 2.0)
multi_json
rack-protection
rack-test
sinatra (~> 1.4.0)
tilt (~> 1.3)
sinatra-flash (0.3.0)
sinatra (>= 1.0.0)
sinatra-reloader (1.0)
sinatra-contrib
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
PLATFORMS
ruby
DEPENDENCIES
activerecord
carrierwave
dotenv
fog
padrino-helpers
pg
pony
sinatra
sinatra-activerecord
sinatra-assetpack
sinatra-flash
sinatra-reloader
Include gem 'erubis' in your Gemfile.
Padrino::Rendering can only be activated if the corresponding gem (erubis, haml or slim) is included into the bundle and visible at the moment of requiring 'padrino-helpers'.
I got this error when running a feature spec using rspec 3.0, ruby 2.0.0p195 on Windows in Rails 4.0. Reading on Googles, I find that a fix was to use a specific version in rpsec 2.0 but nothing past that version. I thought I would have been long past that issue. Like others, I find that when I manually act out the steps of the feature, everything works as expected. There is no indicator of what line of the spec fails. Where should I look in Google to get past this issue? Or have I made a goof somewhere?
gemfile.lock
rspec-core (3.0.2)
rspec-support (~> 3.0.0)
rspec-expectations (3.0.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.0.0)
rspec-mocks (3.0.2)
rspec-support (~> 3.0.0)
rspec-rails (3.0.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.0.0)
rspec-expectations (~> 3.0.0)
rspec-mocks (~> 3.0.0)
rspec-support (~> 3.0.0)
rspec-support (3.0.2)
Fails here: _score_form.html.erb
<%= simple_form_for [#site, #inspection, score] do |f| %>
<%= f.input :note %>
<%= f.button :submit, submit_text %>
<% end %>
<a class="close-reveal-modal">×</a>
note_feature_spec.rb
require 'spec_helper'
feature "notes", js: true do
background do
#surveys = ["Loss", "Solutions"]
#manager = FactoryGirl.create(:manager)
#site = FactoryGirl.create(:site)
#user = FactoryGirl.create(:user, site_id: #site.id)
#survey = FactoryGirl.create(:survey, name: "#{#surveys[1]}", user_id: #manager.id)
#item_1 = FactoryGirl.create(:item, name: "item 1", survey_id: #survey.id, category: "Regular", sub_category:
'DEC')
#variance = FactoryGirl.create(:cash_variance)
end
scenario "appear when saved with a score" do
visit root_path
click_link 'Login'
fill_in 'Email', with: #manager.email
fill_in 'Password', with: #manager.password
click_button 'Log in'
click_link ("#{#site.name}" + " #{#site.site_type}")
click_link 'New Inspection'
select("#{#survey.name}")
click_button 'Start inspection'
score = Score.where(inspection_id: Inspection.last.id, item_id: #item_1.id).first
expect(page).to have_content("#item.name")
expect(page).to have_css("note-act#{#score.id}")
end
end
relevant portion of scores_controller.rb
class ScoresController < ApplicationController
def update
#site = Site.find(params[:site_id])
#inspection = #site.inspections.find(params[:inspection_id])
#score = #inspection.scores.find(params[:id])
respond_to do |format|
if #score.update_attributes(score_params)
format.html {redirect_to edit_site_inspection_path(#site,#inspection), notice: 'Score was updated'}
format.json {head :no_content}
format.js
else
format.html { render action: 'edit'}
format.json { render json: #score.errors, status: :unprocessable_entity }
end
end
end
Top of error message:
1) notes it appears when saved with a score
Failure/Error: Unable to find matching line from backtrace
ActionView::Template::Error:
undefined method `note' for #<Score:0x8acdb60>
# ./app/views/inspections/_score_form.html.erb:2:in `block in _app_views_inspections__score_form_html_erb__524083191_68481552'
# ./app/views/inspections/_score_form.html.erb:1:in `_app_views_inspections __score_form_html_erb__524083191_68481552'
# ./app/views/inspections/_regular.html.erb:13:in `_app_views_inspections__regular_html_erb__743764807_72723960'
# ./app/views/inspections/_clean_scores.html.erb:17:in `block (3 levels) in _app_views_inspections__clean_scores_html_erb___604997166_72361188'
# ./app/views/inspections/_clean_scores.html.erb:15:in `each'
# ./app/views/inspections/_clean_scores.html.erb:15:in `block (2 levels) in
It turns out there is a migration missing, so it is as I suspected: a goof.
In my application staging environment there is an error when I try to access a page over https, the webpage is correctly working with http. The error I get is :
undefined method `each' for #<String:0x00000009371f28>
The place where it fails is on in th gem rack on the line:
body.each { |part| parts << part }
in
def digest_body(body)
parts = []
body.each { |part| parts << part }
string_body = parts.join
digest = Digest::MD5.hexdigest(string_body) unless string_body.empty?
[digest, parts]
end
It seems that he can't handle the body that is passed. I inspected the body and it is a string with all the html code of my page in it. The data type of this parameter should be an array.
"<!DOCTYPE html>\n<html class='no-js' lang='fr' xml:lang='fr'>\n<head>\n<meta charset='utf-8'>\n<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>\n<meta content='width=device-width' name='viewport'>\n<title>Bienvenue sur Zurban Culture | Admin Panel | Zurban Culture</title>\n<meta content=\"authenticity_token\" name=\"csrf-param\" />\n<meta content=\"fEVrJPyUwdf4FZ2GSWW/p01SrByXlJpq+xSbAXOkxBg=\" name=\"csrf-token\" />\n<!--[if lt IE 9]>\n<script src='http://html5shim.googlecode.com/svn/trunk/html5.js' type='text/javascript'></script>\n<![endif]-->\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" type=\"text/javascript\"></script>\n<link href=\"/assets/admin/admin-6033541466a41863e188a9fa9e0ea9bd.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<link href=\"/assets/admin/print-088f5bc50dba980c42676157c724ed0a.css\" media=\"print\" rel=\"stylesheet\" type=\"text/css\" />\n\n<script src='https://www.google.com/jsapi' type='text/javascript'></script>\n\n<link href='/favicon.ico' rel='shortcut icon'>\n</head>\n<body data-offset='50' data-spy='scroll' id='admin_show'>\n<h1 class='hidden print'>\nZurban Culture\n</h1>\n<div class='navbar navbar-fixed-top noPrint'>\n<div class='navbar-inner'>\n<div class='container-fluid'>\n<a class='btn btn-navbar' data-target='.nav-collapse' data-toggle='collapse'>\n<span class='icon-bar'></span>\n<span class='icon-bar'></span>\n<span class='icon-bar'></span>\n</a>\n<a class='brand' href='/admin'>Zurban Culture</a>\n<div class='nav-collapse'>\n<ul class='nav' id='tabbedInterface'>\n<li class=\"dropdown\">Produits<b class=\"caret\"></b><ul class='dropdown-menu'>\n<li>Tous produits (4064)</li>\n<li>Brouillons (156)</li>\n<li>Effacés (274)</li>\n<li>Bons</li>\n<li>Familles (24)</li>\n<li>Maintenance</li>\n</ul>\n</li><li class=\"brands_tab\">Marques</li>\n<li class=\"dropdown\">Ventes & Marketing<b class=\"caret\"></b><ul class='dropdown-menu'>\n<li>En vente (3905)</li>\n<li>Brouillons (142)</li>\n<li>Planning (0)</li>\n<li><span class=\"translation_missing\" title=\"translation missing: fr.admin.menu.sales.planned\">Planned</span></li>\n<li>Codes promotionnels (27)</li>\n<li>Page d'accueil</li>\n<li>Collections</li>\n<li>Chèques cadeaux</li>\n<li>Chèques</li>\n</ul>\n</li><li class=\"dropdown\">Commandes<b class=\"caret\"></b><ul class='dropdown-menu'>\n<li>En attente (0)</li>\n<li>A vérifier (3)</li>\n<li>Payées (7)</li>\n<li>Traitement (0)</li>\n<li>Envoyées (307)</li>\n<li>Complètée (9205)</li>\n<li>Indisponible (1)</li>\n<li>Annulées (8736)</li>\n<li>Fraudes (12)</li>\n<li>Tentatives de paiements</li>\n</ul>\n</li><li class=\"dropdown\">Retours<b class=\"caret\"></b><ul class='dropdown-menu'>\n<li>En attente (77)</li>\n<li>Réceptionné (23)</li>\n<li>Remboursé (1115)</li>\n<li>Procédure annulée (4)</li>\n</ul>\n</li><li class=\"dropdown\">Avis <b class=\"caret\"></b><ul class='dropdown-menu'>\n<li>À approuver (0)</li>\n<li>Approuvés (3)</li>\n<li>Refusés (0)</li>\n<li>Effacés (0)</li>\n</ul>\n</li><li class=\"dropdown\">Utilisateurs<b class=\"caret\"></b><ul class='dropdown-menu'>\n<li>Utilisateurs</li>\n<li>Utilisateurs effacés</li>\n<li>Invitations</li>\n</ul>\n</li><li class=\"help_sections_tab\">Sections d'aide</li>\n<li class=\"dropdown\"><img alt=\"Icon_stats\" src=\"/assets/admin/icon_stats-3905dbfb6e4ba900e54d7c49d67f5c49.png\" /><b class=\"caret\"></b><ul class='dropdown-menu'>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.overview\">Overview</span>\n</li>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.products\">Products</span>\n</li>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.orders\">Orders</span>\n</li>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.returns\">Returns</span>\n</li>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.users\">Users</span>\n</li>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.sales_report\">Sales Report</span>\n</li>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.stock_report\">Stock Report</span>\n</li>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.purchase_report\">Purchase Report</span>\n</li>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.sales_history\">Sales History</span>\n</li>\n<li>\n<span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.favorites\">Favorites</span>\n</li>\n</ul>\n</li></ul>\n\n<ul class='nav pull-right'>\n<li class='searchbox'>\n<form accept-charset=\"UTF-8\" action=\"/admin/search\" class=\"navbar-search pull-right\" method=\"get\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /></div>\n<input class=\"search-query span2\" id=\"query\" name=\"query\" size=\"20\" type=\"text\" value=\"Rechercher\" />\n\n</form>\n\n</li>\n<li class='dropdown'>\n<a class='dropdown-toggle' data-toggle='dropdown' href='#'>\n<i class='icon-user icon-white'></i>\n</a>\n<ul class='dropdown-menu'>\n<li>\nZurban Culture\n</li>\n<li>\nDéconnexion\n</li>\n</ul>\n</li>\n</ul>\n\n</div>\n</div>\n</div>\n</div>\n<div class='container-fluid noPrint'>\n<div class='subnav'>\n<ul class='nav nav-pills'>\n<li class=\"active\">Statistique rapides</li>\n<li>Logs</li>\n</ul>\n\n</div>\n<div class='notices_wrapper noPrint'>\n<div class='row-fluid'>\n<div class='span12'>\n\n</div>\n</div>\n</div>\n</div>\n<div class='container-fluid'>\n<div class='row-fluid'>\n<div class='span12'>\n<div class=\"page-header\">\n <h1>Bienvenue sur Zurban Culture</h1> \n</div>\n\n\n <form accept-charset=\"UTF-8\" action=\"https://beta.jeansattitude.fr/admin\" class=\"well\" method=\"get\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /></div>\n <input class=\"datepicker onChangeSubmit\" id=\"start_date\" length=\"8\" name=\"start_date\" placeholder=\"Start Date\" type=\"text\" value=\"2013-04-01\" />\n <input class=\"datepicker onChangeSubmit\" id=\"end_date\" length=\"8\" name=\"end_date\" placeholder=\"End Date\" type=\"text\" value=\"2013-04-23\" />\n <input type=\"submit\" class=\"btn\">\n </form>\n <div class=\"row-fluid\">\n <div class=\"section dashboard span6\" id=\"orders_section\">\n <div class=\"well\">\n <h2 class=\"sectionHeader\">Montant des ventes cumulés</h2>\n <div id=\"ordersChart\" class=\"graph\" style=\"width: 95%; height: 300px; margin: 0; padding: 0\"></div>\n </div>\n </div>\n <div class=\"section dashboard span6\" id=\"revenue_section\">\n <div class=\"well\">\n <h2 class=\"sectionHeader\">Montant des ventes</h2>\n <div id=\"revenueChart\" class=\"graph\" style=\"width: 95%; height: 300px; margin: 0; padding: 0\"></div>\n </div>\n </div>\n </div>\n\n <div class=\"row-fluid\">\n <div class=\"section dashboard span6\" id=\"orders_shipped_section\">\n <div class=\"well\">\n <h2 class=\"sectionHeader\">Commandes Expédiées</h2>\n <div id=\"shippedOrdersChart\" class=\"graph\" style=\"width: 95%; height: 300px; margin: 0; padding: 0\"></div>\n </div>\n </div>\n\n <div class=\"section dashboard span6\" id=\"users_section\">\n <div class=\"well\">\n <h2 class=\"sectionHeader\">Nouveaux utilisateurs confirmés</h2>\n <div id=\"usersChart\" class=\"graph\" style=\"width: 95%; height: 300px; margin: 0; padding: 0\"></div>\n </div>\n </div>\n </div>\n\n\n <div id=\"revenueChart\"></div>\n<script type=\"text/javascript\" src=\"http://www.google.com/jsapi\"></script>\n<script type=\"text/javascript\">\nvar rgviz_revenueChart = null;\nvar rgviz_revenueChart_data = null;\nfunction rgviz_draw_revenueChart() {\n var query = new google.visualization.Query('http://stats.zurbanculture.fr/orders/datasource');\n var q = 'select toDate(`paid_at`), `old_members`, `new_members` where ((`state` = \"paid\" or `state` = \"processing\" or `state` = \"shipped\" or `state` = \"completed\") and `paid_at` >= \"2013-04-01\" and `paid_at` <= \"2013-04-24\") group by toDate(`paid_at`) order by toDate(`paid_at`) asc label toDate(`paid_at`) \\'Date\\', `old_members` \\'Ventes Anciens Utilisateurs\\', `new_members` \\'Ventes Nouveaux Utilisateurs\\'';\n query.setQuery(q);\n query.send(function(response) {\n rgviz_revenueChart = new google.visualization.ColumnChart(document.getElementById('revenueChart'));\n rgviz_revenueChart_data = response.getDataTable();\n rgviz_revenueChart_options = {\"is3D\":true,\"width\":\"100%\",\"height\":\"80%\",\"legend\":{\"position\":\"bottom\",\"textStyle\":{\"fontSize\":12}},\"chartArea\":{\"left\":70,\"top\":30,\"width\":\"85%\",\"height\":\"75%\"},\"isStacked\":true};\n rgviz_revenueChart.draw(rgviz_revenueChart_data, rgviz_revenueChart_options);\n});\n}\ngoogle.load(\"visualization\", \"1\", {'packages':['corechart']});\ngoogle.setOnLoadCallback(rgviz_draw_revenueChart);\n</script>\n\n\n <div id=\"ordersChart\"></div>\n<script type=\"text/javascript\">\nvar rgviz_ordersChart = null;\nvar rgviz_ordersChart_data = null;\nfunction rgviz_draw_ordersChart() {\n var query = new google.visualization.Query('http://stats.zurbanculture.fr/orders/datasource');\n var q = 'select toDate(`paid_at`), sum(`total`) where ((`state` = \"paid\" or `state` = \"processing\" or `state` = \"shipped\" or `state` = \"completed\") and `paid_at` >= \"2013-04-01\" and `paid_at` <= \"2013-04-24\") group by toDate(`paid_at`) order by toDate(`paid_at`) asc label toDate(`paid_at`) \\'Date\\', sum(`total`) \\'Montant Ventes\\'';\n query.setQuery(q);\n query.send(function(response) {\n rgviz_ordersChart = new google.visualization.ColumnChart(document.getElementById('ordersChart'));\n rgviz_ordersChart_data = response.getDataTable();\n rgviz_ordersChart_options = {\"is3D\":true,\"width\":\"100%\",\"height\":\"80%\",\"legend\":\"none\",\"chartArea\":{\"left\":70,\"top\":30,\"width\":\"85%\",\"height\":\"75%\"}};\n rgviz_ordersChart.draw(rgviz_ordersChart_data, rgviz_ordersChart_options);\n});\n}\ngoogle.setOnLoadCallback(rgviz_draw_ordersChart);\n</script>\n\n <div id=\"shippedOrdersChart\"></div>\n<script type=\"text/javascript\">\nvar rgviz_shippedOrdersChart = null;\nvar rgviz_shippedOrdersChart_data = null;\nfunction rgviz_draw_shippedOrdersChart() {\n var query = new google.visualization.Query('http://stats.zurbanculture.fr/orders/datasource');\n var q = 'select toDate(`shipped_at`), count(`id`) where ((`state` = \"paid\" or `state` = \"processing\" or `state` = \"shipped\" or `state` = \"completed\") and `shipped_at` >= \"2013-04-01\" and `paid_at` <= \"2013-04-24\") group by toDate(`shipped_at`) order by toDate(`shipped_at`) asc label toDate(`shipped_at`) \\'Date\\', count(`id`) \\'Commandes Expédiées\\'';\n query.setQuery(q);\n query.send(function(response) {\n rgviz_shippedOrdersChart = new google.visualization.AreaChart(document.getElementById('shippedOrdersChart'));\n rgviz_shippedOrdersChart_data = response.getDataTable();\n rgviz_shippedOrdersChart_options = {\"is3D\":true,\"width\":\"100%\",\"height\":\"80%\",\"legend\":\"none\",\"chartArea\":{\"left\":70,\"top\":30,\"width\":\"85%\",\"height\":\"75%\"}};\n rgviz_shippedOrdersChart.draw(rgviz_shippedOrdersChart_data, rgviz_shippedOrdersChart_options);\n});\n}\ngoogle.setOnLoadCallback(rgviz_draw_shippedOrdersChart);\n</script>\n\n <div id=\"usersChart\"></div>\n<script type=\"text/javascript\">\nvar rgviz_usersChart = null;\nvar rgviz_usersChart_data = null;\nfunction rgviz_draw_usersChart() {\n var query = new google.visualization.Query('http://stats.zurbanculture.fr/users/datasource');\n var q = 'select concat(month(`created_at`), \" \", year(`created_at`)), `seo`, `organique` where (`created_at` >= \"2012-04-23\" and `created_at` <= \"2013-04-24\" and `confirmed` = 1) group by concat(month(`created_at`), \" \", year(`created_at`)) order by `created_at` asc label concat(month(`created_at`), \" \", year(`created_at`)) \\'Month\\', `seo` \\'SEO\\', `organique` \\'Organique\\'';\n query.setQuery(q);\n query.send(function(response) {\n rgviz_usersChart = new google.visualization.LineChart(document.getElementById('usersChart'));\n rgviz_usersChart_data = response.getDataTable();\n rgviz_usersChart_options = {\"is3D\":true,\"width\":\"100%\",\"height\":\"80%\",\"legend\":{\"position\":\"bottom\",\"textStyle\":{\"fontSize\":12}},\"chartArea\":{\"left\":70,\"top\":30,\"width\":\"85%\",\"height\":\"75%\"}};\n rgviz_usersChart.draw(rgviz_usersChart_data, rgviz_usersChart_options);\n});\n}\ngoogle.setOnLoadCallback(rgviz_draw_usersChart);\n</script>\n\n\n</div>\n</div>\n<footer class='footer'>\n<p>Zurban Culture v2.0 - Rails 3.2.13 (staging) / Ruby 1.9.3 patchlevel 327 2012-11-10 - /srv/www/jeansattitude/releases/20130423082652</p>\n</footer>\n</div>\n<script src=\"/assets/admin-ac2e83dde06736c3279cc5c973afd46a.js\" type=\"text/javascript\"></script>\n\n</body>\n</html>\n"
Someone has an idea why the request fails and the body is not containing and array like it needs to be? Here you see my traceroute, it isn't clear for me what cause the problem because I don't see any trace of my application in it and I don't pass anything to this function from my application.
NoMethodError (undefined method `each' for #<String:0x00000009371f28>):
rack (1.4.5) lib/rack/etag.rb:59:in `digest_body'
rack (1.4.5) lib/rack/etag.rb:26:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.13) 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.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__965187821369700966__call__4271865895200548975__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
airbrake (3.1.11) lib/airbrake/rails/middleware.rb:13:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.13) 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.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63: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'
airbrake (3.1.11) lib/airbrake/user_informer.rb:16:in `_call'
airbrake (3.1.11) lib/airbrake/user_informer.rb:12:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
railties (3.2.13) lib/rails/railtie/configurable.rb:30:in `method_missing'
passenger (3.0.19) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.19) lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
passenger (3.0.19) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.19) lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
passenger (3.0.19) lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
passenger (3.0.19) lib/phusion_passenger/utils.rb:470:in `safe_fork'
passenger (3.0.19) lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.19) lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
passenger (3.0.19) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
passenger (3.0.19) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
passenger (3.0.19) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.19) helper-scripts/passenger-spawn-server:99:in `<main>'
See also my issue I opened on the rack gem, but it seems not a issue from them. https://github.com/rack/rack/issues/548
SOLUTION:
This happened because of a custom middleware that was returning the body as a string, I wrapped this body in an array and problem was solved! Thanks for the help!
You say:
I inspected the body and it is a string with all the html code of my page in it. The data type of this parameter should be an array.
Where is the body parameter coming from? What do you expect the elements of this array to be? It seems like this may be what you want:
def digest_body(body)
parts = body.split("\n")
string_body = parts.join
digest = Digest::MD5.hexdigest(string_body) unless string_body.empty?
[digest, parts]
end