Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Trying to get middleware to work with rails #2

@zkwentz

Description

@zkwentz

I'm trying to get this to work with Rails, can you offer guidance on where I'm going wrong?

~$: cat config/application.rb

require 'phrender'
...
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

config.middleware.use Phrender::RackMiddleware, {
  javascript_files: [:ember_driver,'/assets/application.js'],
  javascript: ['App = Ember.Application.create()'],
  index_file: '/assets/phrender.html'
}

~$: cat public/assets/phrender.html

<!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
    </body>
</html>

~$: rake middleware

use Rack::Sendfile
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007fa3a19e9778>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::RemoteIp
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
use ActiveRecord::Migration::CheckPending
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Phrender::RackMiddleware
run App::Application.routes

~$: cat Gemfile

...
gem 'phrender'

~$: which phantomjs

/usr/local/bin/phantomjs

There are no apparent errors development.log, and it appears as if the page only gets hit once (as I understand after hitting the page the first time phantom js should hit it again?)

Please let me know if more information would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions