Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should flash files be stored in 3.1?

In Rails 3.0.X, I would store my flash files in public/flash. Flash files such as: jwplayer, uploadify, etc.

With the introduction of the new directory structure in 3.1 (i.e. app/assets/), should flash files still be stored in public/flash or should I create a new directory called 'flash' in app/assets/ ?

like image 732
Christian Fazzini Avatar asked May 25 '11 17:05

Christian Fazzini


People also ask

Can a USB 3.1 be used in a 3.0 port?

USB 3.1 is backwards compatible with USB 3.0 and USB 2.0, except in the following scenarios: USB-B 3.1 cables are not compatible with USB-B 2.0 ports. Unless you use an adapter, USB-C ports or cables will not work with USB-A or USB-B ports or cables.

Where do you put flash drives?

A USB drive, also referred to as a flash drive or memory stick, is a small, portable device that plugs into the USB port on your computer.

Can a USB 3.1 be used in a 2.0 port?

One of the most user-friendly aspects of USB is that its primary shape—the classic rectangle (Type-A) —is physically compatible with all earlier versions. This means USB Type-A plugs in versions 3.0, 3.1 or 3.2 will fit into old USB 2.0 ports and vice versa.

What is the difference between 3.0 and 3.1 USB?

Here's the short answer… USB 3.0 is 5Gb/s, USB 3.1 is 10Gb/s, and USB 3.2 is the fastest at 20Gb/s. You may have seen them branded as SuperSpeed USB 5Gbps/10Gbps/20Gbps. The only thing you need to pay attention to is the transfer speeds.


2 Answers

You can use the Sprockets provide directive.

For example, this is how I am using Plupload:

# app/assets/javascripts/plupload.js
//= require plupload/plupload
//= require plupload/plupload.flash
//= require plupload/plupload.silverlight
//= provide plupload/dependencies

The corresponding vendor directory is organised like this:

vendor
├── assets
│   ├── javascripts
│   │   └── plupload
│   │       ├── dependencies
│   │       │   ├── plupload.flash.swf
│   │       │   └── plupload.silverlight.xap
│   │       ├── plupload.flash.js
│   │       ├── plupload.js
│   │       └── plupload.silverlight.js
│   └── stylesheets
└── plugins

I then use <%= javascript_include_tag 'plupload' %> when I want to use Plupload, and use the asset_path helper to populate the Plupload configuration:

<%= javascript_include_tag 'plupload' %>

<script type="text/javascript">
$(function() {
    var uploader = new plupload.Uploader({
        runtimes : 'flash,silverlight',
        multipart : true,
        multipart_params : {
            'authenticity_token' : '<%= form_authenticity_token %>'
        },
        flash_swf_url : 
            '<%= asset_path "plupload/dependencies/plupload.flash.swf" %>',
        silverlight_xap_url :
            '<%= asset_path "plupload/dependencies/plupload.silverlight.xap" %>',
        url : '<%= url_for [@item, :photos] %>',
        // ...
    });

Hope that helps.

like image 100
gjb Avatar answered Oct 25 '22 13:10

gjb


if these are .swf files, I don't think they belong in app/assets. The asset folder allows for pre-"compiled" app asset files for CoffeeScript and SCSS (or similar js and css "compilers"). If you are compiling .as files into .swf files as part of your deploy or startup process, I could see it making sense to put them in the asset folder. However, this seems like a horrible idea.

=================UPDATE=====================

I was wrong. The asset folder is for serving Sprockets assets. As long as you can handle digested asset paths you should use Sprockets.

like image 2
jesse reiss Avatar answered Oct 25 '22 12:10

jesse reiss