<header><h1>Rails SDK </h1>
<p> <a href="https://github.com/transloadit/rails-sdk">transloadit/rails-sdk</a></p></header>

> [!WARNING]
> This SDK has been **deprecated.** Use the [Ruby SDK](/docs/sdks/ruby-sdk.md) or [Uppy](https://uppy.io/) instead.

<span aria-hidden="true" id="user-content-rails-sdk-install"></span>

## Install

```bash
gem install transloadit-rails
```

or add the `transloadit-rails` Gem to your Rails project's `Gemfile` and update your bundle.

```bash
echo "gem 'transloadit-rails'" >> Gemfile
bundle install
```

After installation you need to run the `transloadit:install` generator to complete the setup.

```bash
rails g transloadit:install
```

<span aria-hidden="true" id="user-content-rails-sdk-usage"></span>

## Usage

Refer to the <dfn>Templates</dfn> (which you have set in the
[config](https://github.com/transloadit/rails-sdk/#configuration)) with the `transloadit` helper.

```erb
<%= form_for :upload, :html => { :id => 'upload' } do |form| %>
  <%= transloadit :s3_store %>
  <%= form.label      :file, 'File to upload' %>
  <%= form.file_field :file %>
  <%= form.submit %>
<% end %>

<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' %>
<%= transloadit_jquerify :upload %>
```

This requires jQuery, and loads the
[Transloadit jQuery plugin](https://github.com/transloadit/jquery-sdk/). Be sure to exclude the
`<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' %>` tag if
you already have jQuery loaded.

JavaScript also ensures your form is encoded as `multipart/form-data`.

If you want to use the automatic `transloadit` parameter decoding, you have to include the
`Transloadit::Rails::ParamsDecoder` module into your controller

```ruby
class YourController
  include Transloadit::Rails::ParamsDecoder
end
```

That way the `param[:transloadit]` is automatically decoded for you, if it exists.

> [!NOTE] Since it's still very young, the Transloadit Rails SDK does not include batteries for it
> yet, but if you're looking for a jQuery-less integration, check out [Uppy](/docs/sdks/uppy.md), our
> next-gen file uploader for the web.

<span aria-hidden="true" id="user-content-rails-sdk-example"></span>

## Example

An example rails application following the
[tutorial above](https://github.com/transloadit/rails-sdk/#tutorial) can be found in the
[examples](https://github.com/transloadit/rails-sdk/tree/master/examples) directory.

<span aria-hidden="true" id="user-content-rails-sdk-documentation"></span>

## Documentation

See [GitHub](https://github.com/transloadit/rails-sdk#readme) for the full documentation.
