# Rails SDK

[transloadit/rails-sdk](https://github.com/transloadit/rails-sdk)

###### Warning

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

## Install

![](/_next/static/media/copy.04p1cju9qekk_.svg?dpl=dpl_CtwzFbHWtqiCy9uvWb9fE7WvfP9N)

```bash
gem install transloadit-rails

```

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

![](/_next/static/media/copy.04p1cju9qekk_.svg?dpl=dpl_CtwzFbHWtqiCy9uvWb9fE7WvfP9N)

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

```

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

![](/_next/static/media/copy.04p1cju9qekk_.svg?dpl=dpl_CtwzFbHWtqiCy9uvWb9fE7WvfP9N)

```bash
rails g transloadit:install

```

## Usage

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

![](/_next/static/media/copy.04p1cju9qekk_.svg?dpl=dpl_CtwzFbHWtqiCy9uvWb9fE7WvfP9N)

```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

![](/_next/static/media/copy.04p1cju9qekk_.svg?dpl=dpl_CtwzFbHWtqiCy9uvWb9fE7WvfP9N)

```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.

## 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.

## Documentation

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