rails surveyor gem example gets sass syntax error - ruby-on-rails-3

I'm installing the surveyor gem in a new (test) rails 3 project. I've run rails g surveyor:install, and rake db:migrate, and rake surveyor FILE=surveys/kitchen_sink_survey.rb
and then run rails server
It seems to "work" only the sass is not compiling correctly, so i get no styles and the page contains:
Syntax error: Invalid property: ":background-color= !background_color".
I'm running in Windows, with Ruby 1.9.2, the Gemfile contains
gem 'rails', '3.0.9'
gem 'sqlite3'
gem 'surveyor', :git => 'git://github.com/breakpointer/surveyor.git', :branch => 'rails3'
gem 'formtastic'
gem 'haml'
gem 'sass'
gem 'rake', '0.8.7'

Are you using the latest version of the gem? The breakpointer version is no longer the official branch. Check https://github.com/NUBIC/surveyor instead.

Related

therubyracer error on heroku as "Failed to install gems via Bundler."

When i push my app to heroku it gives me following error
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* therubyracer
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/Rails app
I deleted my Gemlock file and again bundle install it but still gives me same error. I also tried bundle install --without development:test for production it also gives me same error What can I do. Here is my Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.9'
gem 'carrierwave'
gem 'newrelic_rpm'
#gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
#gem "twitter-bootstrap-rails"
gem 'will_paginate', '3.0.3'
#gem 'bootstrap-will_paginate', '0.0.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#gem 'mysql2'
gem 'dynamic_form'
gem 'therubyracer', '0.10.2', :platforms => :ruby
gem 'devise'
gem 'hirb'
# Gems used for Facebook
gem 'facebook_oauth'
gem 'oauth','0.4.7'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'thin'
gem 'pg'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
#gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
Try run bundle install than push changes to remote repo.
Also if you use therubyracer for assets compilation, you may precompile assets locally and read this docs:
https://devcenter.heroku.com/articles/rails-asset-pipeline#compiling-assets-locally
https://devcenter.heroku.com/articles/rails-asset-pipeline#therubyracer
therubyracer gem is used to evaluate JavaScript from within Ruby(It embeds the JavaScript interpreter into Ruby).
This gem is required, if you are developing in Ubuntu since, ubuntu doesn't have a Javascript runtime.
But its not case with Heroku.
So, just keep the line for therubyracer gem in the Gemfile under development group like shown below :
group :development do
gem 'therubyracer', '0.10.2', :platforms => :ruby
end
According to Heroku docs:
If you were previously using therubyracer or therubyracer-heroku, these gems are no longer required and strongly discouraged as these gems use a very large amount of memory.
As a replacement on Ubuntu you can install NodeJS:
sudo apt-get install nodejs

I can't run rspec

$bundle exec rspec spec/
Could not find rake-0.9.2.2 in any of the sources
Run `bundle install` to install missing gems.
I'm totally new to Rails and trying to read the tutorial: http://ruby.railstutorial.org/chapters/static-pages#sec:TDD
However, when I try to run rspect, I get that error.
Any ideas on what I'm doing wrong?
EDIT My Gemfile
source 'http://rubygems.org'
gem 'rails', '3.1.3'
gem 'sqlite3', '1.3.5'
gem 'rake', '0.9.2.2'
group :development do
gem 'rspec-rails', '2.8.1'
end
group :test do
gem 'rspec-rails', '2.8.1'
gem 'webrat', '0.7.3'
end
gem 'jquery-rails'
You might want to add
gem "rake", '0.9.2.2'
to your gemfile (under gem 'rails' or what so ever..).
Run bundle install afterwards
Then run bundle exec rspec spec at last.
Will this work for you? If not, any error messages?
If there are error messages please type rake -V and bundle exec rake -V in your console and share us the versions!

spree install undefined method mass_assignment_sanitizer

I took a look about this problem within the list of question but nothing helped.
This is my first question in stackoverflow so please accept my apologies in case I do something wrong. Also I still have a lot of english to improve.
I'm installing Spree following the github instructions
$ gem install spree
$ rails new my_store
$ spree install my_store
when I get this message
...
Admin Password [spree123]
gemfile spree
gemfile spree_usa_epay
gemfile spree_skrill
run bundle install from "./my_store"
git://github.com/spree/spree_usa_epay.git (at 0cb57b4) is not checked out. Please run `bundle install`
precompiling assets
git://github.com/spree/spree_usa_epay.git (at 0cb57b4) is not checked out. Please run `bundle install`
...
Well, as the guide suggests, in case of circular dependency issues do:
$ gem install spree_cmd
$spree install my_store -A
gemfile spree
gemfile spree_usa_epay
gemfile spree_skrill
run bundle install from "./my_store"
git://github.com/spree/spree_usa_epay.git (at 0cb57b4) is not checked out. Please run `bundle install`
precompiling assets
git://github.com/spree/spree_usa_epay.git (at 0cb57b4) is not checked out. Please run `bundle install`
I changed directory to the app and run the command:
$cd my_store
$bundle install
and I get the following error
Bundler could not find compatible versions for gem "rails":
In Gemfile:
spree_usa_epay (>= 0) ruby depends on
rails (<= 3.1.3, >= 3.1.1) ruby
rails (3.2.1)
after this I changed the gem file to work with rails 3.1.3 and coffeescript gems and repeat the whole process again and I get this.
Users/Snake/.rvm/gems/ruby-1.9.3-p0/gems/activerecord- 3.1.3/lib/active_record/base.rb:1088:in `method_missing': undefined method `mass_assignment_sanitizer=' for ActiveRecord::Base:Class (NoMethodError)
from /Users/Snake/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/railtie.rb:59:in `block (3 levels) in <class:Railtie>'
It think it might be something with version of rails a spree but I don't know were to start.
Does anybody had this issue before?
I running Mac OS X 10.5.8
rails 3.2.1
ruby 1.9.3p0 (2011-10-30 revision 33570) [i386-darwin9.8.0]
ImageMagick #6.7.4-6_0+q16
As #Anatoly Ruchka suggested the problem was using rails 3.2.1, so I switched to 3.1.3.
This is what I did, I found a post of #vonconrad where he explain how to create a rail project without touch the installation.
1) I create a directory folder for my project:
$mkdir old_rails313
$cd old_rails313
$touch gemfile
$nano gemfile
2)
I pasted a gemfile definition specifying as you mention the version of rails I want, so it looks like this
source 'http://rubygems.org'
gem 'rails', '3.1.3'
gem 'sqlite3'
group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem "rspec-rails", ">= 2.8.0.rc1", :group => [:development, :test]
gem "factory_girl_rails", ">= 1.4.0", :group => :test
gem "cucumber-rails", ">= 1.2.0", :group => :test
gem "capybara", ">= 1.1.2", :group => :test
gem "database_cleaner", ">= 0.7.0", :group => :test
gem "launchy", ">= 2.0.5", :group => :test
#gem "devise", ">= 1.5.0"
gem 'spree','1.0.0'
3) then I run
bundle install
bundle exec rails new .
rails g spree:install
rails s
After installing I've got a conflict with the gem 'spree','1.0.0', so I comment it out.
Also I've got a warning but it works:
[DEPRECATION WARNING] Nested I18n namespace lookup under "activerecord.attributes.spree/order" is no longer supported
Thanks a lot
I think you should use rails version 3.1.3 for spree_usa_epay
TO do that you should uninstall all rails what you have on machine
to watch use
gem list -d rails
than
sudo gem uninstall rails -v ...
and create new project with
rails new my_store
than edit Gemfile and paste
gem 'spree', '1.0.0'
and
bundle install
well done
rails server

Can't activate rack when running cucumber

I can no longer run cucumber in my rails 3 app. I'm not sure exactly when it broke but I did do some rspec work that required me to use the webrat gem and it was working before that.
My error is:
$ cucumber
Using the default profile...
can't activate rack (~> 1.2.1, runtime) for ["actionpack-3.0.7", "railties-3.0.7"], already activated rack-1.3.0 for ["rack-test-0.5.7", "cucumber-rails-0.4.1"] (Gem::LoadError)
Here is my Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.7'
gem 'sqlite3'
gem 'devise'
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
gem 'cancan'
group :development, :test do
gem 'rspec-rails', '2.5.0'
gem 'rspec', '2.5.0'
gem 'webrat', ">= 0.7.2"
gem 'cucumber-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'launchy'
gem 'factory_girl_rails'
gem 'spork'
end
Please let me know if I need to supply more info and I'll edit this.
I've tried specifying rack in my Gemfile but this doesn't seem to help and doesn't seem right. Also: If I modify my Gemfile I am running "bundle install" and then trying cucumber again. Is this the right workflow to solve this problem?
Can anyone please help?
Cheers,
Rim
Someone in my IRC channel pointed me in the right direction.
Use the context of bundler (which I don't quite understand yet)
bundle exec cucumber
This works just fine :)

Rails 3 Cucumber Load Error

I am trying to get cucumber to work with Rails 3.
But whenever I try to run the cucumber features I get an load error.
cucumber-0.7.3/lib/cucumber/ast/feature_element.rb:2:in `require': no such file to load -- gherkin/parser/tag_expression (LoadError)
I have added the following gems to the Gemfile
gem "rspec", '>= 2.0.0.beta.19'
gem 'capybara'
gem 'database_cleaner'
gem 'cucumber-rails', '~> 0.1.1.rc6'
gem 'cucumber', '~> 0.7.0.beta.8'
gem 'rspec-rails', '~> 2.0.0.beta.19'
gem 'spork'
gem 'launchy'
I'm running on ruby-1.9.2-p0
Any suggestions?
I was getting the same error and was able to move past it by forcing gherkin to be loaded in Gemfile instead of as a cucumber dependency.
So, assigning specific version to Gherkin and >= to cucumbers:
...
gem 'gherkin', '2.1.5'
gem 'cucumber-rails', '>=0.3.2'
gem 'cucumber', '>=0.8.5'
...