Giter VIP home page Giter VIP logo

Comments (3)

j-mcnally avatar j-mcnally commented on July 21, 2024

Hey bob,
I dont think we've tried html before.
It looks like your carrierwave mount is setup a bit differently than us.

the error
NoMethodError: undefined method 'id' for #File:ad_block.html

makes sense, because i believe something is looking for a model, with an id rather than a IOObject which is what File:ad_block.html in your example is.

If you look at
https://github.com/kohactive/assetable/tree/master/app/models
you should see the subset of model types supported, i would suggest trying out Document.

Assetable expects the attachment should be a model reference so you would want to do something like this.
publisher.ad_block = Document.create(filename: File.open("ad_block.html")
This will do 2 things, create an Asset object with a type of 'Document' using STI (Single Table Inheritence) and assign it to the ad_block relationship on publisher.

I believe in the next release we will probably swap out root level models included with namespaced models.

Assetable::Document to prevent collision in integrating apps where they already have a Document model.

You can then get the url to the attachment with

publisher.ad_block.filename.url

from assetable.

johnkoht avatar johnkoht commented on July 21, 2024

Hey @rlmattax one other thing that you'll need to change is the acceptable document formats. Check out the javascript file https://github.com/kohactive/assetable/blob/master/app/assets/javascripts/assetable/assetable_uploader.js.coffee#L74-L83 and you'll see that it only accepts certain types of files. I think this was an oversight and needs to be addressed.

from assetable.

rlmattax avatar rlmattax commented on July 21, 2024

Thanks guys. Very helpful. I'll try it out again and see if those suggestions helped.

from assetable.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.