krists / refile-postgres Goto Github PK
View Code? Open in Web Editor NEWPostgres database as a backend for Refile
License: MIT License
Postgres database as a backend for Refile
License: MIT License
Hi (again ;)),
I did discover an issue with 'assets:precompile' (Rails 4).
Normaly Rails 4 does not need a db connection for assets:precompile.
But with refile-postgres setup within the initializer a connection is needed.
This is bad in my case because I don't have a route from my asset hosts to my db servers.
Proc initializer become more and more charming ;)
regards
dieter
Hey @krists
Rails beginner here...
I'm getting an undefined method error on my controller#create (default from scaffold) method.
form
<div class="field">
<%= f.label :file %><br>
<%= f.attachment_field :file %><br>
</div>
require "refile"
Refile.configure do |config|
config.store = Refile::Postgres::Backend.new(ActiveRecord::Base.connection.raw_connection)
end
"file"=>#<ActionDispatch::Http::UploadedFile:0x007f9a1925d1a8 @tempfile=#<Tempfile:/var/folders/kr/cpw88nhx6clgd4hjzkqp4rg80000gn/T/RackMultipart20150119-88383-1caehtl.xml>,
@original_filename="buildInformation_SIGAA_3.7.0_3.7.35.ufopa.xml",
@content_type="text/xml",
@headers="Content-Disposition: form-data; name=\"build_information_file[file]\"; filename=\"buildInformation_SIGAA_3.7.0_3.7.35.ufopa.xml\"\r\nContent-Type: text/xml\r\n">},
It's runs just fine when I set the backend as FileSystem, so I'm guessing that is the Postgres backend.
Any ideas?
Rails 4.2.0, Refile 0.5.3, Postgres backend, Ruby 2.2.0
Thanks
Serving the content directly through the Rails-App is expensive. So I configured my
asset host (nginx) as an caching proxy. Maybe someone can use it too, so I like to share it.
I don't know where to put it. Maybe as an example would it be good.
http {
...
proxy_cache_path /.../shared/public/uploads levels=1:2 keys_zone=my_app_production:250m inactive=6000m;
server {
server_name assets.my-app.example.com
proxy_cache my_app_production;
location ^~ /attachments/ {
gzip_static on;
expires max;
add_header Cache-Control public;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_ignore_headers Set-Cookie Cache-Control Expires;
proxy_cache_key $host$uri$is_args$args;
proxy_hide_header Set-Cookie;
proxy_hide_header Cache-Control;
proxy_hide_header Expires;
proxy_cache_valid 200 600m;
proxy_store_access user:rw group:rw all:r;
proxy_store on;
proxy_cache_bypass $http_secret_header;
proxy_pass http://www.my-app.example.com ;
}
HI there,
Running into this error:
Bundler could not find compatible versions for gem "refile":
In Gemfile:
refile
refile-postgres was resolved to 1.4.0, which depends on
refile (~> 0.6.2)
Could not find gem 'refile (~> 0.6.2)', which is required by gem 'refile-postgres', in any of the relevant sources:
https://github.com/refile/refile.git (at master@e690bf5)
How can I resolve this issue?
Hi,
I tested refile postgres with unicorn. There are some issues with the connection. When
used with preload_app true
DB connections are closed before fork and so this gem doesn't work any more. Is there a way to reinject a new connection?
regards
Dieter
I'm having this issue on Heroku: http://stackoverflow.com/questions/15014692/pg-largeobject-access-on-heroku
Inserting file attachements into Postgres appears to work, but reading them back out errors with:
ERROR: permission denied for relation pg_largeobject
Perhaps, the Gem needs to use pg_largeobject_metadata
instead of pg-largeobject
?
Considering pg_largeobject returns an OID, it will make sense that ID to be stored in the OID type.
Otherwise garbage collection processes like vacuumlo
cannot count references of orphaned objects.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.