I've been trying to get ActiveAdmin to work with my Rails 3.1.1 application. It mostly works until I was looking at the web developers console and noticed images weren't being loaded:
GET http://localhost:3000/images/active_admin/datepicker/datepicker-nipple.png 404 (Not Found)
I came across some people with similar problems, pointing out the url should have been generated with 'assets' not images. I tried the recommendations I found to update the 'sass-rails' gem but I had no luck.
I tried to start a brand new application from scratch with Rails 3.1.1 (the original app was Rails 3.1.0 not sure if the upgrade made the difference then a fresh start) and did the recommended fixes first and now every image loads fine. I tried to copy the similar part of the Gemfile back but it didn't seem to fix my actually application's problem. This is the area around the related lines in my Gemfile:
gem 'sass-rails', '~> 3.1.4'
gem 'meta_search', '>= 1.1.0.pre'
gem 'activeadmin'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
Any tips?
Fixed this by completely uninstalling gems and deleting the gemset I was using with RVM for this project and redoing everything in a new version of rails (2.3). Following a similar issue on github leads me to believe this isn't an issue in a new release of ActiveAdmin but this was my solution.
Related
I get the following error issued by Phusion when loading a web page:
There was an error while trying to load the gem 'compass-rails'.
Gem Load Error is: undefined method `has?' for Sass::Util:Module
Did you mean? hash
Hash
Backtrace for gem load error is:
/Volumes/Data/htdocs/zetcho/vendor/bundle/gems/compass-0.12.2/lib/compass/sass_extensions/functions/urls.rb:5:in `has?'
The code at the indicated location is:
module Compass::SassExtensions::Functions::Urls
def self.has?(base, instance_method)
Sass::Util.has?(:instance_method, base, instance_method)
end
My gem file contains:
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.2'
# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.18'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Compass for stylesheets
gem 'compass-rails'
# Use the Compass extension susy
gem "sprockets"
gem 'susy'
I've just created the Ruby on Rails site using Rails 5.1.2 and ruby 2.3.1. I have a much older site that works fine with the gem. Did I miss a step in the overall install or is this a bug with compass-rails?
I got the same error when I tried to add a controller:
rails generate controller home index
After more digging around, I found a similar problem. I fixed this one by changing the gem file to:
gem 'compass-rails', github: 'Compass/compass-rails'
Then:
rm gemfile.lock
bundle
It seems that the issue can be found in compass-rails 2.0.0. The version 3.0.2 seems to fix this issues. So a possible solution is :
# Gemfile
gem 'compass-rails', '~> 3.0.2'
Then bundle update compass-rails
This avoids targeting the compass-rails git master branch in favor of an actual release.
I came here having the same issue with a grunt compiling issue trying to use Compass/Sass, if this might help someone, my issue was caused because I had an updated version of Sass (sass-3.7.4) that was higher that the max-version compatible with compass, I uninstalled sass:
gem uninstall sass
Which in turn uninstalled compass, and reinstalled compass letting it choose the right version, and problem solved.
gem install compass
I have been repeating this tutorial for weeks now:
https://www.digitalocean.com/community/articles/how-to-1-click-install-ruby-on-rails-on-ubuntu-12-10-with-digitalocean
Here are the specifics of my project:
I am using Mongoid with database.yml production set to my tested and working Droplet (DigitalOcean VPS) running MongoDB.
My gem file is here, I am new to Rails and am not quite sure if it's set up right, so I just moved them all to assets hoping Unicorn might serve these gems for me?
source 'https://rubygems.org'
gem 'rails', '3.2.14'
# 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'
gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"
gem 'redcarpet', '1.17.2'
gem 'uglifier', '>= 1.0.3'
gem "will_paginate_mongoid"
gem 'will_paginate', '~> 3.0.5'
gem 'will_paginate-bootstrap'
gem 'devise'
gem 'jquery-rails'
gem "mongoid", "~> 3.0.0"
end
Here's what I did:
I used DigitalOcean's 1 click installer. Then I used FileZilla to SFTP into the credentials they provided me with. I deleted all the files in /home/rails and put my new files in from my project. Then I executed bundle install, and restarted the unicorn service. In the tutorial I had seen I can track the log of unicorn, so I executed this: tail -f /home/unicorn/log/unicorn.log
Here is the output which concerns me:
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup': You have already activated rack 1.5.2, but your Gemfile requires rack 1.4.5. Using bundle exec may solve this. (Gem::LoadError)
I saw some other solutions to this, all failed. Here are the solutions I tried:
Deleting my Gemfile.lock, and re bundle installing it. Going into the file and removing where it said rack. Running bundle install --binstubs. Restarting the unicorn service with bundle exec before it. The error remains the same.
I've had many different errors before, but I feel this is the closest I have gotten. If someone could explain this to me (I'm new to Rails and would like a thorough explanation) and possibly help me fix the error that would be fantastic and end this frustration.
Just a wild guess
gem "rack", "~> 1.4.5"
May work for you, then of course bundle install afterwards.
This solves the problem:
gem uninstall rack -v 1.5.2
Possibly reload your Ubuntu installation from the DigitalOcean control panel, then try and install Ruby on Rails with Apache and Passenger?
Install RoR
Install Passenger (skip to passenger installation)
You will have errors when first creating your site with rails new as it will try and use SQL when it won't be installed, if you wish to use MongoDB
I'm trying to use the BlueCloth gem in order to parse some markdown for my rails app. I added it to my gem file:
gem 'BlueCloth'
In my .html.erb views I user the code
<%= BlueCloth.new(post.content).to_html.html_safe %>
To render the markdown as html. This works completely fine in my local dev environment, but when I push to heroku, even after running bundle install and restarting the app, accessing the app generates internal server errors.
I get the following error in the logs:
ActionView::Template::Error (uninitialized constant ActionView::CompiledTemplates::BlueCloth):
I include BlueCloth in the gem file:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'pg'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'devise'
gem 'BlueCloth'
I have also run the command bundle install via the heroku command line.
Thanks for the help!
It looks like your manually requiring files. It might be easier for you if you use bundler to require everything for you and then you dont have to add require to any other .rb file. Its very simple to do this. Depending on your Rails version, here are two links that should help you out:
Rails 2.3
Rails 3
The issue was that I was using the old version of the BlueCloth gem.
The old gem is called BlueCloth and the new one is called bluecloth
Changing the line in my gem file:
gem 'BlueCloth'
To:
gem `bluecloth`
Fixed it.
Thanks.
I am currently encountering couple of issues with the a rails application deployed on Linode server. The gemfile looks like below :
source 'https://rubygems.org'
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 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'rails', '3.2.8'
gem 'mysql2'
gem 'activeadmin',:git => "git#github.com:sadanmasroor/active_admin.git"
gem 'jquery-rails'
gem 'roo'
group :production do
gem 'unicorn'
end
group :development do
gem 'thin'
gem 'capistrano'
end
Apparently there were list of issues with ActiveAdmin in the beginning mostly with activeadmin assets which I finally overcame by debugging the issues. Now the problem is that the assets precompile successfully in development and also in production ( Capistrano Assets Precompile Task) however I am getting a 500 error when accessing the index page even.
The weird part is that there is no error in production log. It just shows that the assets precompiled successfully. I have no idea what exactly is causing this issue. I have been trying to figure this thing out for almost three days now. Have tried literally everything I could to resolve it from the ActiveAdmin issues to stackoverflow and everything but no result. If I revert the code to the last stable one and than deploy everything works perfectly.
I would be very thankful to anybody who can point me to the right direction to fix this thing.
Thanks
After spending almost 2 days to fix the issue I used the old version of ActiveAdmin instead of the new latest release and everything worked like a charm.
We have a rails 3 app, it was working great, we deployed it. I had to set up a new computer for development, cloned my repo, set everything up, and now Font Awesome fonts refuse to work (show gibberish). I cloned into my original computer; in my original folder, they work fine. But any new clones do not.
Instead of showing the font, they show the content (gibberish set in the scss file, like '\f010'). This is usually displayed as a strange shape or something, but definitely not the icon. Tried on Mac OS X Mountain Lion and Ubuntu 12.04, Chrome and Firefox.
What we tried:
Made a new branch in original folder. Updated all gems to newest
version - I thought the clone might have newer gems that made it
break somewhere. Original project still looks fine, new clones (and
checking out the branch) are broken.
Replaced the .scss and font files from fresh download from the
fontawesome site.
Verified path is correct for font files (they seem to be found,
because Chrome inspector doesn't complain about missing font files -
if I change the path, it does complain. They just aren't being
used/used properly)
Gem list in both folders show same gems with same versions.
FontAwesome path is:
myapp/vendor/assets/stylesheets/FontAwesome
with the sass and fonts folders inside of that.
The only thing changed in the sass was the path line:
$fontAwesomePath: "FontAwesome/font/fontawesome-webfont" !default;
Which, as I said, seems to work; if I change the path, chrome complains about the missing fonts.
I am using Apache 2, Ruby ree-1.8.7 p-358, Rails 3.2.7, Passenger 3.0.12, RVM 1.14.10, Bundler 1.1.4. Passenger and bundler sit in my global gemset. Here is my Gemfile:
# myapp/Gemfile
# The specified versions are to make sure everything is as it is in the
# original folder; didn't make a difference. But the original branch has
#them and is working.
source 'https://rubygems.org'
gem 'rails', '3.2.7'
gem 'chronic', '0.6.7'
gem 'enumerated_attribute', '0.2.16'
gem 'exception_notification', '2.6.1'
gem 'google-api-client', '0.4.5'
gem 'her', '~> 0.2.6'
gem 'jquery-rails', '2.0.2'
gem 'mysql2', '0.3.11'
gem 'paperclip', '~> 2.7.0'
gem 'pdfkit', '0.5.2'
gem 'remotipart', '~> 1.0'
gem 'settingslogic'
gem 'slim-rails'#, '1.0.3'
gem 'validates_timeliness', '~> 3.0.2'
gem 'whenever', '0.7.3', :require => false
group :assets do
gem 'compass-rails'#, '1.0.3'
gem 'sass-rails'#, '3.2.5'
end
gem 'coffee-rails'#, '3.2.2'
gem 'uglifier'#, '1.2.7'
group :development do
gem 'quiet_assets', '1.0.1'
gem 'thin' , '1.4.1'
end
gem 'letter_opener', '0.0.2', :group => [:development, :test, :staging]
gem 'rspec-rails', '2.11.0', :group => [:development, :test]
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '1.7.0'
gem 'guard-rspec', '1.2.1'
gem 'shoulda', '3.1.1'
end
If anyone needs more info just let me know. I've run out of ideas and I'm not getting anywhere, and I'm worried to deploy now and have our prod env messed up!
EDIT: Still not getting results. I updated to Rails 3.2.8 and all gems are at their latest, except for paperclip and factory_girl_rails, which use older versions for Ruby 1.8.7.
Destroyed all my folders, cloned a new one, works fine. Cloned a second, no good. Open first clone in Chrome incognito window, doesn't work. Inspector -> Resources -> Frames -> (site) -> Fonts shows the font files.
Here's an image of what it should look like (left) vs the problem (right):
try this, i recently had a similar issue,
if you put this at the top of your CSS files,
/*
*= require font-awesome
*/
and then use this gem 'font-awesome-rails' it should work