rails4 + bootstrap displays the error as "variable #zindex-modal-background is undefined" - ruby

I'm trying to make the project that use bootstrap on rails4.1.6.
Here is gemfile:
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootswatch-rails', '~> 3.1.1'
gem 'twitter-bootswatch-rails-helpers'
$ bundle install was successful.
and settings of bootswatch
$ rails g bootswatch:install cerulean
$ rails g bootswatch:import cerulean
$ rails g bootswatch:layout cerulean
app/assets/stylesheet/application.css
*= require cerulean/loader
*= require cerulean/bootswatch
app/assets/javascript/application.js
//= require cerulean/loader
//= require cerulean/bootswatch
but $ rails s and when I viewed the site , appears the following error:
variable #zindex-modal-background is undefined
(in /Users/ko2ic/sample/app/assets/stylesheets/cerulean/loader.css.less)
How do you solve it doing?

It was resolved by adding the next code:
assets/stylesheets/cerulean/variables.less
#zindex-modal-background: 0;
reference:
http://github.com/scottvrosenthal/twitter-bootswatch-rails/issues/30

Related

the irbrc config file doesn't work for ruby 2 + rails 4

The irbrc config file works on the rails 3.2 + ruby 1.9
Today I checked out a project, using rails 4 + ruby 2,
and I found it didn't load the .irbrc file (I put the file under my home directory)
When I ran into irb or rails console
What's the problem?
irbrc file
require 'irb/completion'
require 'hirb' ; Hirb.enable
ARGV.concat ["--readline", "--prompt-mode", "simple"]
IRB.conf[:SAVE_HISTORY] = 10000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
ActiveRecord::Base.logger.level = 1 # Avoid log in Rails console
ActiveRecord::Base.logger = Logger.new STDOUT #顯示 SQL statements
ActiveRecord::Base.connection.tables
def drop_tbl (tblname)
ActiveRecord::Migration.drop_table(eval(":"+tblname))
end
def show_tbls
tbls = ActiveRecord::Base.connection.tables
tbls.each { |tbl|
puts "#{tbl} #{tbl_name(tbl)}"
}
end
def tbl_name(name)
name.singularize.humanize.split().map{|x| x.capitalize}.join()
end
def cols (tblname)
cols = eval("#{tblname}.column_names")
ap(cols)
end
Gemfile in the project
source 'https://rubygems.org'
ruby '2.0.0'
gem 'bootstrap-sass'
gem 'coffee-rails'
gem 'rails'
gem 'haml-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'jquery-rails'
group :development do
gem 'sqlite3'
gem 'pry'
gem 'pry-nav'
gem 'thin'
gem "better_errors"
gem "binding_of_caller"
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
I believe the irb config file doesn’t get loaded in rails console if the file is erroneous. Run ruby ~/.irbrc to make sure that it evaluates without complaint. Additionally, you can verify that your console is even sourcing your irbrc by running $LOAD_PATH.index{|s| s.include?('irbrc')} within your console.
You're using Pry. Try renaming the file to .pryrc.

Ruby not finding gems, but they appear on gem list, and work in irb console?

I've got a Ruby app using deamon-kit to create a daemon that runs a cron task every 3 seconds.
Problem is I'm trying to add some error checking using Errbit, so that requires me to:
require 'hoptoad_notifier'
in my script. However, the script is complaining it can't find the file?
.rvm/gems/ruby-1.9.2-p320#stitch/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require': no such file to load -- hoptoad_notifier (LoadError)
What confuses me is that the gem is installed, when I run
gem list | grep hoptoad_notifier
I get
hoptoad_notifier (2.4.11)
Another test I did was to pop into irb console, on the same terminal window, after making sure I'm inside the correct RVM gemset off course:
1.9.2p320 :001 > require 'hoptoad_notifier'
=> true
1.9.2p320 :002 >
And voila, hoptoad is loading. It's only when loading my deamon-kit deamon, that I get the error.
What further confuses me is that when I look at my require block:
require 'rubygems'
require 'resque'
require 'hoptoad_notifier'
It's finding rubygems and resque, but not hoptoad_notifier? Why, when I comment out hoptoad, it doesn't also complain about resque and rubygems?
dameon-kit uses bundler, so you don't need to include rubygems. Include the following lines to your Gemfile :
gem 'resque'
gem 'hoptoad_notifier'
Run bundle install
and include your gems as usual :
require 'resque'
require 'hoptoad_notifier'
It worked for me.

How to: Coffeescript-Compiling in Aptana

I installed Aptana, and i want to try Coffeescript. When I try to "Compile and display JS" it won´t work - console shows:
....xyz.sh: line 3: coffee: command not found
....xyz.sh: line 3: pre: command not found
I don´t get it - how do i get it to run?
Thank you!
Edit:
Since yesterday I managed to get compass/sass running in Aptana (yeah!) - so i realized that my question might be wrong: Do i have to tell Aptana (Windows?) where to find the compiler?
Edit 2:
Realized: The problem is - how can this gem be installed (in Aptana if possible):
via https://github.com/netzpirat/guard-coffeescript
I get an error when installing the guard gem:
ERROR: Error installing guard:
The 'ffi' native gem requires installed build tools.
After trying some stuff here is a litte tutorial to setup compass and coffeescript for a project in Aptana:
(Info: I know very little about coding or ruby, so please be patient :) )
Create project ( i choose basic web template)
Terminal:
$ gem install compass
$ compass create myProject --using blueprint
check:
http://compass-style.org/reference/blueprint/
You also have to setup some other stuff:
I found this page and followed it through..
https://github.com/netzpirat/guard-coffeescript
Install bundle:
$ gem install bundle
$ bundle init //to create the gemfile
Install guard:
You need to install Ruby Devkit before - check this links:
http://rubyinstaller.org/downloads/
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
If you did so
$ gem install guard
$ gem install guard-coffeescript
I also installed a JS-Engine as recommended here:
https://github.com/netzpirat/guard-coffeescript#javascript-runtimes
$ gem install therubyrhino
For Coffeescript:
$ gem install coffee-script
$ gem install coffee-script-source
Then you have to edit the gemfile, mine looked like this:
# A sample Gemfile
source "https://rubygems.org"
# gem "rails"
group :development do
gem 'guard'
end
group :development do
gem 'guard-coffeescript'
end
group :development do
gem 'therubyrhino'
end
run bundle
$ bundle
create guardfile
$ guard init
edit the guardfile
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'coffeescript', :input => 'myProject/coffeescript', :output => 'myProject/javascript'
you can start the guard with
$ guard start
This worked for me! If you see any mistakes please let me know!

Rack/Sinatra LoadError: cannot load such file

I'm trying to build an app using Sinatra, Ruby, rack, haml, pony and SendGrid, with git and RVM for deployment on Heroku. The app is a blog variant that should send out an email with commentary submitted on a form. On my local server, when the form submits I get the following error:
LoadError at /
cannot load such file -- pony
file: tools.rb location: require line: 314
BACKTRACE
(expand)
/Users/Kevin/prog/ruby/Sinatra/Noobs/noobs.rb in block in <top (required)>
require 'pony'
When run on Heroku, form submittal results in an internal server error. The 'cannot load such file' error suggests that the file is not on the gem path, but if I understand correctly, the OS disagrees:
➜ noobs git:(master) ✗ bundle show pony
/Users/Kevin/.rvm/gems/ruby-1.9.3-p194#noobs/gems/pony-1.4
➜ noobs git:(master) echo $GEM_PATH
/Users/Kevin/.rvm/gems/ruby-1.9.3-p194#noobs:/Users/Kevin/.rvm/gems/ruby-1.9.3-p194#global
Here is the code where pony is required (noobs.rb):
require 'rubygems'
require 'sinatra'
require 'haml'
require "sinatra/reloader" if development?
# ...
post '/' do
require 'pony'
Pony.mail(:from => params[:name] + "<" + params[:contact] + ">",
What do I need to do to get pony to work?
require "bundler/setup"
Will probably fix your error.
Since you are using Bundler with Sinatra you need to require Bundler for the bundled gems to work. You probably have your gems split between Bundler and your gemset. If you have Sinatra and Haml in your gemset but Pony in your Gemfile you will see a LoadError.
I write down name of the gem (pony - in my case) in Gemfile - and it starts to work.
Just open Jemfile - and write down words jem "pony" in the new line I get the following paste2.org/6hVxHXKH

Issue installing Nokogiri Gem w/ Rails: "Could not find "Nokogiri..."

Nokogiri is in my gem file. Bundle install returns the expected output:
Using nokogiri (1.4.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
When trying to execute db:create:all I get the following error:
rake db:create:all
Could not find nokogiri-1.4.4 in any of the sources
If I test in irb, I also get the expected output.
irb(main):003:0> require "rubygems"
=> true
irb(main):004:0> require "nokogiri"
=> true
I have uninstalled and install nokogiri along with its dependencies multiple times.
I'm using:
Rails 3.0.6
Ruby 1.8.7
Any help would be greatly appreciated.
EDIT: 4/25/11 3:02pm EDT
For comment below: Gemfile line for nokogiri is
gem "nokogiri", '1.4.4', :require => "nokogiri"
I made a test with your case in mind.
My Gemfile is like this:
gem "nokogiri", '1.4.4', :require => "nokogiri"
And then rake db:migrate worked just fine
This may be a long shot but you could try:
bundle install --no-deployment
If you are in deployment mode Rails will look for your gems in the vendor directory, rather then the usual install location. It can cause this kind of error.

Resources