GithubHelp home page GithubHelp logo

actionpack-page_caching's Introduction

Welcome to Rails

What's Rails?

Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

Understanding the MVC pattern is key to understanding Rails. MVC divides your application into three layers: Model, View, and Controller, each with a specific responsibility.

Model layer

The Model layer represents the domain model (such as Account, Product, Person, Post, etc.) and encapsulates the business logic specific to your application. In Rails, database-backed model classes are derived from ActiveRecord::Base. Active Record allows you to present the data from database rows as objects and embellish these data objects with business logic methods. Although most Rails models are backed by a database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as provided by the Active Model module.

View layer

The View layer is composed of "templates" that are responsible for providing appropriate representations of your application's resources. Templates can come in a variety of formats, but most view templates are HTML with embedded Ruby code (ERB files). Views are typically rendered to generate a controller response or to generate the body of an email. In Rails, View generation is handled by Action View.

Controller layer

The Controller layer is responsible for handling incoming HTTP requests and providing a suitable response. Usually, this means returning HTML, but Rails controllers can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and manipulate models, and render view templates in order to generate the appropriate HTTP response. In Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and controller classes are derived from ActionController::Base. Action Dispatch and Action Controller are bundled together in Action Pack.

Frameworks and libraries

Active Record, Active Model, Action Pack, and Action View can each be used independently outside Rails.

In addition to that, Rails also comes with:

  • Action Mailer, a library to generate and send emails
  • Action Mailbox, a library to receive emails within a Rails application
  • Active Job, a framework for declaring jobs and making them run on a variety of queuing backends
  • Action Cable, a framework to integrate WebSockets with a Rails application
  • Active Storage, a library to attach cloud and local files to Rails applications
  • Action Text, a library to handle rich text content
  • Active Support, a collection of utility classes and standard library extensions that are useful for Rails, and may also be used independently outside Rails

Getting Started

  1. Install Rails at the command prompt if you haven't yet:

    $ gem install rails
  2. At the command prompt, create a new Rails application:

    $ rails new myapp

    where "myapp" is the application name.

  3. Change directory to myapp and start the web server:

    $ cd myapp
    $ bin/rails server

    Run with --help or -h for options.

  4. Go to http://localhost:3000 and you'll see the Rails bootscreen with your Rails and Ruby versions.

  5. Follow the guidelines to start developing your application. You may find the following resources handy:

Contributing

We encourage you to contribute to Ruby on Rails! Please check out the Contributing to Ruby on Rails guide for guidelines about how to proceed. Join us!

Trying to report a possible security vulnerability in Rails? Please check out our security policy for guidelines about how to proceed.

Everyone interacting in Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Rails code of conduct.

License

Ruby on Rails is released under the MIT License.

actionpack-page_caching's People

Contributors

claudiob avatar dhh avatar frodsan avatar fxn avatar gregmolnar avatar guilleiguaran avatar iggant avatar jackmc avatar jbampton avatar kaspth avatar mechanicles avatar michiels avatar nilbus avatar nyjt avatar parndt avatar pixeltrix avatar prathamesh-sonpatki avatar pzgz avatar rafaelfranca avatar robzolkos avatar tenderlove avatar zigomir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

actionpack-page_caching's Issues

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

  spec.license = 'MIT'
  # or
  spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

double slashed home page url creates `.html` page cache file

The double-slashed url does not match the empty? or "/" condition here

so it is interpreted as a legit url, the trailing slash is chomped, and a file is created at /.html.

For example www.my_domain.com// will page cache to /public/cache/.html.

In testing, our NGINX setup serves this file up as an octet-stream, causing it to be downloaded instead of displayed in the browser. To make this even harder to diagnose, the file is hidden on unix-based systems because it begins with a dot.

Js stimulus, i18n and cache

Hi,

I use i18n js (https://github.com/fnando/i18n-js) in a stimulus controller attach to a div in a index's page which I have set caches_page :index in the controller.

I was thinking the js would only be execute on client side so that I can have i18n working depending on the lang the client set ... but it not seems working.

May I made an error ?

Thanks.

page_cache_directory is not initialized or set from config

In Rails 3.2 page_cache_directory is initialized to app.config.paths["public"].first in:

https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/action_controller/railtie.rb

But this doesn't seem the case in this gem. It is never given a default and the value is never copied over from config so the page_cache_directory variable is always blank.

This results in the gem trying to write pages to the root of my web server when upgrading to Rails 4.

Cache is writing but not reading

I'm new to page caching so I'm probably doing something wrong.

In my config/environments/staging.rb file I added:

config.action_controller.page_cache_directory = "#{Rails.root.to_s}/public/deploy"

In my products controller I added:

caches_page :show

The static html page is generated, but each time a request comes in, it still goes through the controller, renders the views, and the writes the static html page.

Here's a top and bottom snippet of my logs:

I, [2015-05-22T20:38:23.065217 #7107]  INFO -- : Started GET "/products/1" for 104.131.133.17 at 2015-05-22 20:38:23 -0400
I, [2015-05-22T20:38:23.066890 #7107]  INFO -- : Processing by ProductsController#show as HTML
I, [2015-05-22T20:38:23.067016 #7107]  INFO -- :   Parameters: {"id"=>"1"}
D, [2015-05-22T20:38:23.070506 #7107] DEBUG -- :   Product Load (0.5ms)  SELECT  "pro

....

D, [2015-05-22T20:38:23.116643 #7107] DEBUG -- :   Customer Load (0.7ms)  SELECT  "customers".* FROM "customers" WHERE "customers"."tenant_id" = $1 AND "customers"."status" = $2 AND "customers"."id" = $3  ORDER BY "customers"."id" ASC LIMIT 1  [["tenant_id", 1], ["status", 0], ["id", 1]]
I, [2015-05-22T20:38:23.117293 #7107]  INFO -- :   Rendered shared/_main_nav.html.erb (3.3ms)
I, [2015-05-22T20:38:23.118509 #7107]  INFO -- : Write page /var/www/myapp/releases/11/public/deploy/products/1.html (0.4ms)
I, [2015-05-22T20:38:23.119214 #7107]  INFO -- : Completed 200 OK in 52ms (Views: 32.2ms | ActiveRecord: 4.8ms | Elasticsearch: 0.0ms)

Amy ideas?

Not writing files to cache after upgrade to Rails 5.1

Have recently moved from Rails 4.2 to 5.1, have been using to cache a dynamic stylesheet successfully but is not working in rails 5.1, using actionpack 1.1.1.

I consistently get errors trying to access the stylesheet as the expected cached file is not there.
For example:

Started GET "/stylesheets/207.css" for 127.0.0.1 at 2019-03-04 15:44:52 +1100
Processing by StylesheetsController#show as CSS
  Parameters: {"id"=>"207"}
Completed 500 Internal Server Error in 29ms (ActiveRecord: 2.2ms)

ActionView::MissingTemplate - Missing template stylesheets/show, application/show with {:locale=>[:en], :formats=>[:css], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby]}. Searched in:

I am running in development, and development.rb caching section looks like:

  # Enable/disable caching. By default caching is disabled.
  if Rails.root.join('tmp/caching-dev.txt').exist?
    config.action_controller.perform_caching = true
    config.cache_store = :memory_store
    config.public_file_server.headers = {
      'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
    }
  else
    config.action_controller.perform_caching = false
    config.cache_store = :null_store
  end

I am using "bin/rails dev:cache" to enable caching from rails guides.
my controller looks like this:

# frozen_string_literal: true

class StylesheetsController < ApplicationController
  caches_page :show, gzip: true

  def show
    @stylesheet = Stylesheet.find(params[:id])
    respond_to do |format|
      format.html
      format.css { render text: @stylesheet.contents, content_type: "text/css" }
    end
  end
end

I am expecting to see a public/stylesheets created with a file for the css but the folder is not being created.

Any ideas gratefully accepted!

Not working from inside engine controller

I want to cache my http status response pages, and I use my mountable engine to generate those pages for each of my applications. The problem is that nothing gets cached. I've verified that the controller method is being executed as I actually do get the fully generated HTML response; it's just that the file isn't saved to /public. You'll note below that I attempt to log the public directory inside the page_cache_directory proc but I don't see any logs written either.

Main app:

config/application.rb: config.exceptions_app = routes


Engine:

lib/manager/engine.rb: (don't know for sure if this is what I need to require, so I tried both)

require 'actionpack/page_caching'
require 'action_controller/page_caching'

Routes:

%w(401 403 404 410 422 500).each do |code|
  get code, to: 'errors#show', as: "error_#{ code }", code: code
end

ErrorsController:

require_dependency 'manager/application_controller'
module Manager
  # Raise templated HTTP response pages
  class ErrorsController < ApplicationController
    skip_before_action :login_required
    skip_before_action :find_model

    self.page_cache_directory = -> { Rails.logger.debug Rails.root.join('public').inspect; return Rails.root.join('public') }
    caches_page :show

    def show
      render_status params[:code]
    end

    protected

    def render_status(status = 500)
      status = status.to_i
      respond_to do |format|
        format.any(:html, :shtml) do
          render "#{ status }.html", status: status
        end
      end
    rescue ActionController::UnknownFormat, ActionView::MissingTemplate
      head status: status
    end
  end
end

I also call caches_page directly in one of the main application's controller and it works. It's just from within the rails engine that it doesn't.

Defining cache directory using domain is not working

Hi,

I'm trying to setup my cache directory like that

class PagesController < ApplicationController
  self.page_cache_directory = -> { Rails.root.join("public", request.domain) }

But it don't create a folder request.domain but write cache directly on public/ folder

Please expand on web server configuration comment

"Page caching works by configuring a web server to first check for the existence of files on disk, and to serve them directly when found, without passing the request through to Action Pack."

Could you please expand on that or perhaps link to external sources explaining how that is accomplished for some mainstream web servers like Apache?

I'd be happy to submit a pull request to embellish the documentation if somebody can point me towards where to find the information.

Thank you.

multi domain issue

how to handle if we serving to multiple domain with same code and same db based on domain name,if an action is cached it show every one same page?

how about with locale?

For example, we have products.en.erb, products.fr.erb in app/views/home that respond to home#products in separate locale.

Release notes or Changelog for new versions?

I'm working to upgrade from 1.1.1 to 1.2.1 or beyond, but I'm having trouble finding documentation of the differences in the versions. I see a couple of releases under "releases", but the latest version is 1.0.1. The CHANGELOG seems to go up to 1.1.1. I see that there are some new tags beyond 1.1.1, but would like some context around what the changes are in the different versions. Is there more info on these versions somewhere else?

Is expire_fragment still working?

Hi, I'm testing here a Rails 4 app enabling caching on the development mode, but no matter what I do, fragments are not expired.

I have this code on my view at app/views/books/index.html.erb:

  <tbody>
    <% cache do %>
      <% @books.each do |book| %>
      ...
      <% end %>
    <% end %>      

And I'm using a callback on the books controller like this:

  after_action :expire_cache, only: [:update, :destroy]
  ...
    def expire_cache
      expire_fragment action: "index"
    end

When loading the page the first time, I get

Write fragment views/localhost:3001/books/ad710ad1703013e012cef8000213c386

After updating a book, I get

Expire fragment views/localhost:3001/books

But when loading the action index again, I still get

Read fragment views/localhost:3001/books/ad710ad1703013e012cef8000213c386

with the old results. I noticed the hash on the end, not used when expiring the fragment. Am I missing something?

Thanks!

No option for conditional page caching

When page caching was a part of Rails I could use a condition to determine whether or not the page was cached.

caches_page :new, unless: proc { user_signed_in? || !flash.empty? }

i.e., I only want to cache the page if no users are signed in and there are no warnings/errors/info in the flash object. However the presence of any conditional (if or unless) negates the page caching altogether.

question: page caching with multiple domains

Hi, is it possible to use page caching with multiple domains?
I would like to write html files in filesystem like page cache does, but putting them into a folder named with the domain
Then, I would use nginx and rewrite to show these pages

expire_page doesn't seem to work with controller and action

The documentation makes it seem like you can do:

expire_page controller: 'home', action: 'index'

But this doesn't seem to work. The page isn't being expired.
Also, after looking through the tests, it seems only expiring a page with a custom route is tested?

expire_page '/index.html'

Rails 5.2 Support

Is there any discussions about upgrading this to 5.2?

Currently using this gem with no sucess:

gem "actionpack-page_caching", git: "https://github.com/kord-as/actionpack-page_caching", branch: "rails5"

Still going through ActionPack? am i doing it wrong?

controller

class PjController < ApplicationController
  caches_page :news, :contact, :about, :recruit, :index, :products, :acide_series, :bio, :global, :cold_rolling, :hot_rolling, :industries, :machines, :manager, :senior, :manager, :services, :strategy, :timeline
end

application.rb

require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)

module Pj
  class Application < Rails::Application
    config.time_zone = 'Beijing'
    config.i18n.default_locale = :'zh-CN'
    config.i18n.fallbacks = true
    config.action_controller.page_cache_directory = "#{Rails.root.to_s}/public/deploy"
  end
end

production.log

I, [2015-01-21T14:08:10.033309 #1266]  INFO -- : Started GET "/contact" for 222.73.202.249 at 2015-01-21 14:08:10 +0800
I, [2015-01-21T14:08:10.039919 #1266]  INFO -- : Processing by PjController#global as HTML
W, [2015-01-21T14:08:10.784323 #1266]  WARN -- : zh-TW
I, [2015-01-21T14:08:10.789743 #1266]  INFO -- :   Rendered pj/_contact_banner.html.erb (0.3ms)
I, [2015-01-21T14:08:10.790854 #1266]  INFO -- :   Rendered pj/_slider_js.html.erb (0.3ms)
I, [2015-01-21T14:08:10.791057 #1266]  INFO -- :   Rendered pj/global.zh-TW.html.erb within layouts/application (3.2ms)
I, [2015-01-21T14:08:10.794608 #1266]  INFO -- :   Rendered pj/_header.html.erb (1.1ms)
I, [2015-01-21T14:08:10.795809 #1266]  INFO -- :   Rendered pj/_footer.html.erb (0.4ms)
I, [2015-01-21T14:08:10.796650 #1266]  INFO -- : Write page /var/www/pj/releases/44/public/deploy/contact.html (0.3ms)
I, [2015-01-21T14:08:10.796939 #1266]  INFO -- : Completed 200 OK in 757ms (Views: 11.2ms | ActiveRecord: 0.0ms)
I, [2015-01-21T14:08:10.935224 #1266]  INFO -- : Started GET "/assets/logo.png" for 222.73.202.249 at 2015-01-21 14:08:10 +0800
I, [2015-01-21T14:08:10.979164 #1266]  INFO -- : Started GET "/assets/5-1.jpg" for 222.73.202.249 at 2015-01-21 14:08:10 +0800
I, [2015-01-21T14:08:10.980454 #857]  INFO -- : Started GET "/assets/alibaba-logo.png" for 222.73.202.249 at 2015-01-21 14:08:10 +0800
I, [2015-01-21T14:08:10.981162 #847]  INFO -- : Started GET "/assets/alibaba.png" for 222.73.202.249 at 2015-01-21 14:08:10 +0800
I, [2015-01-21T14:08:11.017641 #847]  INFO -- : Started GET "/assets/5-3.jpg" for 222.73.202.249 at 2015-01-21 14:08:11 +0800
I, [2015-01-21T14:08:11.017904 #857]  INFO -- : Started GET "/assets/wx.png" for 222.73.202.249 at 2015-01-21 14:08:11 +0800
I, [2015-01-21T14:08:11.020339 #1266]  INFO -- : Started GET "/assets/wx-logo.jpg" for 222.73.202.249 at 2015-01-21 14:08:11 +0800
I, [2015-01-21T14:08:11.029397 #1266]  INFO -- : Started GET "/assets/5-4.jpg" for 222.73.202.249 at 2015-01-21 14:08:11 +0800
I, [2015-01-21T14:08:11.049045 #1266]  INFO -- : Started GET "/assets/1-5.jpg" for 222.73.202.249 at 2015-01-21 14:08:11 +0800

Rails 5 status?

I'm creating a Rails 5 JSON API, and since the cache! method is broken in jbuilder. this seems like just the thing.

I see there are existing PRs and closed issues, but is there any update on when this'll work with Rails 5?

Caching async pages

It doesn't caching async elements.
Is there any option to cache after the render finished?

New changes broke gem and it generate empty files

Hello. Looks like this commit did something bad and gem start generate empty files. After switching to:

gem 'rails', '5.0.0.1'
gem 'actionpack-page_caching', git: 'https://github.com/rails/actionpack-page_caching', ref: '3180f5ee17c4d161c4739a3f9c2e34e01d7261b7'

All start working as expected (no empty files).

Page Caching - Errno::EACCES (Permission denied @ dir_s_mkdir - /api)

Hi, I'm trying to used page caching for my API app with Rails 5.2.1 and actionpack-page_caching 1.1.1,
In ApplicationController if inherit from ActionController::Base, no problem found for cache page,
But if I used ActionController::API, I got error when cache_page like this:

Errno::EACCES (Permission denied @ dir_s_mkdir - /api):
/usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:232:in mkdir' /usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:232:in fu_mkdir'
/usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:210:in block (2 levels) in mkdir_p' /usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:208:in reverse_each'
/usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:208:in block in mkdir_p' /usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:193:in each'
/usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:193:in mkdir_p' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:167:in write'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:80:in block in cache' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:176:in block in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in block in instrument' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in instrument' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:176:in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:79:in cache' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:282:in cache_page'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:231:in block in caches_page' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in instance_exec'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in block in make_lambda' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:236:in block in halting_and_conditional'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:517:in block in invoke_after' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:517:in each'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:517:in invoke_after' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:133:in run_callbacks'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in process_action' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in process_action'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in block in process_action' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in block in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in instrument' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in process_action' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in process_action'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in process' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in process'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/live.rb:255:in block (2 levels) in process' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/dependencies/interlock.rb:42:in block in running'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/concurrency/share_lock.rb:162:in sharing' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/dependencies/interlock.rb:41:in running'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/live.rb:247:in block in process' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/live.rb:291:in block in new_controller_thread'

In my ApplicationController:

class ApplicationController < ActionController::API
    include ActionController::RequestForgeryProtection
    include ActionController::Caching

what should I do?

config.action_controller.page_cache_directory not working

config.action_controller.page_cache_directory not working in production.rb (rails 4)
/gems/actionpack-4.0.0/lib/action_controller/railtie.rb:55:in `block (3 levels) in class:Railtie': Invalid option key: page_cache_directory= (RuntimeError)

But

class ApplicationController < ActionController::Base
  include ActionController::Caching::Pages
  self.page_cache_directory = "#{Rails.root.to_s}/public/page_cache"
end

working fine

Rails 5 Support

Will this gem be supported in Rails 5? Currently the gemspec states:

gem.add_dependency 'actionpack', '>= 4.0.0', '< 5'

which doesn't support 5.0.0.beta1

Push to rubygems

Is it possible to get this pushed to rubygems now rails 4 is in beta?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.