you can use ```type``` param to create this object or set type attribute with type from params
```ruby
@material = type.classify.constantize.create params[:material]
# or you can set type field.
@material = Material.create params[:material]
```
And use ```respond_with @material```