I am working on a Rails CMS gem. I want the Gem to have its own Public dir (like Rails) to hold css/js/images etc... I have been trying a lot of different pathing options from my Gem-centric views, but no matter what I try I can''t target any of the files. Any thoughts on how to set this up? Thanks, Elliott G -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Philip Hallstrom
2010-Sep-15 23:47 UTC
Re: How would I set up a Rails-style Public dir in a Gem?
> I am working on a Rails CMS gem. I want the Gem to have its own Public > dir (like Rails) to hold css/js/images etc... I have been trying a lot > of different pathing options from my Gem-centric views, but no matter > what I try I can''t target any of the files. > > Any thoughts on how to set this up?I don''t recall the plugin/gem that did this, but it ran all of the css/js/images through Rails routes with caching. So you get penalized that first time, but from then on they are cached... Or you might override compute_path() and have it look in your gem/public directory first or last if it doesn''t already exist, etc. -philip -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Schuerig
2010-Sep-15 23:58 UTC
Re: How would I set up a Rails-style Public dir in a Gem?
On Thursday 16 September 2010, elliottg wrote:> I am working on a Rails CMS gem. I want the Gem to have its own > Public dir (like Rails) to hold css/js/images etc... I have been > trying a lot of different pathing options from my Gem-centric views, > but no matter what I try I can''t target any of the files.I don''t think you can do what you''re trying to do in Rails alone, however, I''d appreciate to be shown wrong. The reason is that public is not handled by your application at all. Rather, requests to files in public are handled by the web server -- and that''s a good thing, because apache or nginx are much faster at serving static files than Rails proper would be. I take it, the usual way to add assets from a gem is to include a generator that copies (or links) these assets to the application''s public directory. Michael -- Michael Schuerig mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Sep-16 00:00 UTC
Re: How would I set up a Rails-style Public dir in a Gem?
Elliott Golden wrote:> I am working on a Rails CMS gem. I want the Gem to have its own Public > dir (like Rails) to hold css/js/images etc... I have been trying a lot > of different pathing options from my Gem-centric views, but no matter > what I try I can''t target any of the files. > > Any thoughts on how to set this up?ln -s mygem/public RAILS_ROOT/public/mygem I''m not convinced that this is a great idea.> > Thanks, Elliott GBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks for the helpful input guys! I may end up just using a generator to move a dir to Rails public. That would work, I just prefer the idea of the Gem encapsulating everything so that when a user updates the Gem they will have all the new assets without having to run an "update" task or generator. Elliott G On Sep 15, 8:00 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Elliott Golden wrote: > > I am working on a Rails CMS gem. I want the Gem to have its own Public > > dir (like Rails) to hold css/js/images etc... I have been trying a lot > > of different pathing options from my Gem-centric views, but no matter > > what I try I can''t target any of the files. > > > Any thoughts on how to set this up? > > ln -s mygem/public RAILS_ROOT/public/mygem > > I''m not convinced that this is a great idea. > > > > > Thanks, Elliott G > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > Sent from my iPhone > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.