Rails 4 full page caching is not working - ruby-on-rails

Rails4 full page caching is removed and extracted as gem and I am using that gem called 'actionpack-page_caching', but it is not working. It is throwing undefined method `caches_page' for controller class. I tried a lot to debug the issue but no relevant documentation for the same. Please help me out with the solutions.

Even though your bundle command says you have those 2 gems installed
gem 'actionpack-page_caching'
gem 'actionpack-action_caching'
Try to delete the Gemfile.lock file and run the bundlecommand again.
And my output on the second run was correct:
Installing actionpack-action_caching (1.1.0)
Installing actionpack-page_caching (1.0.2)
And I was able to use caches_page.

Related

Ruby on Rails 4, Gem Install

I have had a lot of difficulty installing Gems into my Rails 4 Apps that I have built. For example, I have recently had issues with these two Gems:
Ckeditor:
https://github.com/galetahub/ckeditor
Twitter Bootstrap 3:
https://github.com/twbs/bootstrap-sass
I have no idea what I am doing wrong, in the slightest. I include the gems in my Gem file (gem 'ckeditor_rails'), and then I run 'bundle install'. However, whenever I provide my includes in my application.js (example: '//= require ckeditor/init'), my app yells at me and tells me that it cannot resolve the file. When I check why, its because no file was ever downloaded. Even though the gem installed with no errors. I have got to think I am doing something wrong. Any advice?
Before installing gem, first noted if there is any dependency gem. if the gem having dependency gem means you must install it first. and you may edit in your project/gem file gem 'ckeditor' and gem 'bootstrap-sass' and then run the server.

Deploying rails, paperclip error, no such file to load -- cocaine

Using the paperclip-cloudfiles fork of paperclip:
gem 'paperclip-cloudfiles', '~>2.3', :require => 'paperclip'
Using passenger and I get the following load error: no such file to load -- cocaine
Key part of stack trace:
.rvm/gems/ruby-1.9.2-p180/gems/paperclip-cloudfiles-2.3.10.1/lib/paperclip.rb 43 in `'
Paperclip works fine locally on the development server. Haven't been able to find any reference to this problem. Any ideas?
I would add
gem require 'cocaine'
to your Gemfile then run bundle install again.
Extra credit . . . add the dependency to the gem itself and send it back to the community at large.
Updated: per this issue, you should specify version 0.3.2 of cocaine or Paperclip will break. Paperclip currently relies on an older Cocaine API, so specifying the version (0.3.2) in the gemfile in necessary or paperclip won't work.
gem "cocaine", "0.3.2"
[SOLVED]: Downgraded paperclip-cloudfiles to '2.3.8' and it works. Must be a problem with the current version.
Have you already run bundle install on your production server?
You can simply install the missing cocaine gem by
'gem install cocaine'
and everything works.
This might be related to this issue. Paperclip currently relies on an older Cocaine API, so specifying the version (0.3.2) in the gemfile in necessary or paperclip won't work.

Installing gems tutorial

Is there anywhere that there are step by step instructions on how to install gems?
My google-fu is weak and those that I could find did not resolve my error.
My errors are detailed here:
Getting gcal4ruby gem to work
Basically my error sums up as:
gem installs properly and is detectable by,
but whenever I try to reference it in my application it just says:
Could not find 'gcal4ruby (= 0.0.5, runtime)' in any of the gem sources Try running 'bundle install'.
(* I tried bundle install -> no help *)
Your error states:
Could not find 'gcal4ruby (= 0.0.5, runtime)' in any of the gem sources Try running 'bundle install'.
It's looking for 0.0.5 of gcal4ruby, which you don't have installed, rather you're saying yourself that the gem list -d shows:
gcal4ruby (0.5.5)
Which is not the correct version. I would recommend attempting to discover what's trying to require this older version of gcal4ruby. I think it's in your Gemfile, but I have been known to be wrong occasionally.
If this answer doesn't solve your question, then please attach the errors you're getting and your Gemfile to your question.
As a guess, you are using rails 3? Rails 3 uses a project called bundler for dependencies, so instead of installing the gem in your system ruby, add gem 'gcal4ruby to the Gemfile in the root of your app. after that, a bundle install will install the gem locally into your app.
Bundler means that rails 3 apps have their gems completely isolated from the system gems. Even if the gem is installed in the system, it will not be accessible in the app.

Rails 3.0.3, rails_admin gem, generator not found

I am getting error installing Rails_admin with rails 3.0.3. Command line log shown below -
C:\rorprj\app>gem uninstall rails_admin
Successfully uninstalled rails_admin-0.0.0
C:\rorprj\app>gem install rails_admin
Temporarily enhancing PATH to include DevKit...
Successfully installed rails_admin-0.0.0 1 gem installed
Installing ri documentation for rails_admin-0.0.0...
Installing RDoc documentation for rails_admin-0.0.0...
C:\rorprj\app>rails generate rails_admin:install_admin
**Could not find generator rails_admin:install_admin.**
C:\rorprj\app>rails -v
Rails 3.0.3
Anything I can do fix this?
Try this
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
Sometimes the actual github repo has an different version. I have it running on 3.0.3 and that is what is in my gemfile.
If you call
rails generate rails_admin
the 'help' returns
*Hello, to install rails_admin into your app you need to ru*n:
rake rails_admin:install
And this works. I just encountered the same problem as you. (Keep in mind that you need to add the gem to the gemfile too)
Did you add this gem to your Gemfile? This file is responsible for loading all gems that your application depends on, and if this gem isn't specified in it then it will not be loaded.

Getting gcal4ruby gem to work

I'm trying to create a RoR web application that allows people to connect to their accounts to google calendar.
I found a gem called gcal4ruby that seemed to do the right things based on looking at sample code and its documentation.
I ran gem install and the cmd claimed the installation was ok.
However, when I added the gem to my gemfile then try to run the server again I get:
Could not find 'gcal4ruby (= 0.0.5, runtime)' in any of the gem sources
Try running 'bundle install'.
Then I tried bundle install which basically gets me the message above and a line:
Fetching source index for http://rubygems.org/
Could not find 'gcal4ruby (= 0.0.5, runtime)' in any of the gem sources
Yet when I type in "gem list -d g", gcal4ruby (0.5.5) appears on the list.
I've tried adding in requires and includes but that just gets me uninitialized constant errors.
Other details that may be relevant:
ruby 1.8.7
rails 3.0.1
gem check --alien returns:
mysql-2.8.1-x86-mingw32 has 1 problems
.require_paths:
Extra file
*Note: This doesn't seem to negatively impact me when I'm doing anything though.
If possible, please supply tutorials/sites with samples of working code.
Cheers,
Zigu
Could you post your gemfile please?
I'm guessing your Gemfile reads
gem 'gcal4ruby', '0.0.5'
which means it will only look for that specific verison. So there are two ways to fix this.
Change it to minimum version syntax
gem 'gcal4ruby', '>= 0.0.5'
Change to correct specific gem version
gem 'gcal4ruby', '0.5.5'
Hope that helps

Resources