Comments (7)
Tricky. I have no idea how engines work. Could it be that they somehow end up using a different form builder? I'm afraid I'm not much help on this one.
from refile.
I looked at this a bit and it's not that the form builder helper isn't available; it is. It's the helper the form builder helper calls that isn't available, the @template.attachment_field
here:
def attachment_field(method, options = {})
self.multipart = true
@template.attachment_field(@object_name, method, objectify_options(options))
end
None of the helpers defined in app/helpers/attachment_helper.rb
seem to be available inside another engine.
from refile.
That being said, it's not difficult to include it yourself:
module Blorg
class ApplicationController < ActionController::Base
helper AttachmentHelper
end
end
from refile.
There is, however, another issue with the helpers, from an engine perspective. The attachment_url
helper calls refile_app_path
. Because refile mounts itself at /attachments
within Rails.application.routes
, the path is only available through the main app.
That is, within another engine, you would have to refer to the refile path as main_app.refile_app_path
.
from refile.
Which is also quite simple to fix yourself, by delegation:
module Blorg
module ApplicationHelper
def refile_app_path
main_app.refile_app_path
end
end
end
However, these things should perhaps be made to work out of the box?
from refile.
I'm not sure. Does main_app
work outside engines as well? If it does, then adding it is no harm, I guess. As for including the helper, I doubt there's really anything we can do there which isn't super hacky, so I'd rather not.
from refile.
Yes I believe main_app
is always defined.
from refile.
Related Issues (20)
- Refile JS as an NPM package HOT 1
- Attachment URL not correct for S3 direct uploads + CloudFront HOT 1
- Can not fetch remote image with https HOT 2
- Outdated version HOT 1
- Release a new gem HOT 4
- Changing the RandomHasher to urlsafe_base64 HOT 1
- Custom processors HOT 1
- New release on RubyGems HOT 7
- CDN issue when updating to 0.6.2
- Download directly from S3 HOT 1
- Not possible to assign an attachment which previously was nil
- IO stream closed on create method only - Tempfile is being closed before save HOT 2
- attacher.size is stored as a String and compared with a number
- Empty content-type into windows
- Rail 6 credentials
- Bump rest-client dependency up to ~> 2.0.0
- [Ruby2.7] `warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call` HOT 1
- Introduce Appraisal
- Error occurs in ruby 3.0.0
- Use image_processing gem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from refile.