Originally posted here: http://stackoverflow.com/questions/15986969/where-to-put-plugin-images-in-rails-application We use handful of plugins in our Rails application(Rails 3.2.1). As we already know that we should keep all app images app/assets/images folder and css in app/assets/stylesheets. This is what we follow. However some plugins use images and keep them in parallel to CSS file.(images and CSS in same folder/level) So my question is: (We use Asset Pipeline) 1. Is it a good practice to keep images of plugin in parallel to CSS file? (I am hoping it''s good thing) 2. If not, then developer has to change the image paths in entire css file (if putting plugin images inapp/assets/images), Which I think is not helpful for future in case you plan to upgrade those plugins. Thanks. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/OMfFgRvVr1EJ. For more options, visit https://groups.google.com/groups/opt_out.
Walter Lee Davis
2013-Apr-13 14:10 UTC
Re: Where to put plugin images in Rails application?
On Apr 13, 2013, at 7:24 AM, deepak wrote:> Originally posted here: http://stackoverflow.com/questions/15986969/where-to-put-plugin-images-in-rails-application > > We use handful of plugins in our Rails application(Rails 3.2.1). As we already know that we should keep all app images app/assets/images folder and css in app/assets/stylesheets. This is what we follow. > > However some plugins use images and keep them in parallel to CSS file.(images and CSS in same folder/level) > > So my question is: (We use Asset Pipeline) > > • Is it a good practice to keep images of plugin in parallel to CSS file? (I am hoping it''s good thing) > • If not, then developer has to change the image paths in entire css file (if putting plugin images inapp/assets/images), Which I think is not helpful for future in case you plan to upgrade those plugins. > Thanks. > >You might want to put these in the app/vendor/plugin_name/assets folder tree, so you can keep them separate from your application''s own code. If these stylesheets are written with "awareness" of a folder hierarchy, like maybe with ../images/icon.png style references to images, then you may have trouble with the asset pipeline. I just ran into that in a project here, and had to give up and let the "magic" work by removing all prefixes. Once I did that, and just referenced url(icon.png) in my CSS, everything just worked. (icon.png was in the app/assets/images folder, the stylesheet referencing it was in the app/assets/stylesheets folder.) Walter> -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/OMfFgRvVr1EJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Thanks Walter. So in your opinion it is always good to write css without folder prefixes. Am I getting you right here? -deepak On Saturday, April 13, 2013 7:40:36 PM UTC+5:30, Walter Lee Davis wrote:> > > On Apr 13, 2013, at 7:24 AM, deepak wrote: > > > Originally posted here: > http://stackoverflow.com/questions/15986969/where-to-put-plugin-images-in-rails-application > > > > We use handful of plugins in our Rails application(Rails 3.2.1). As we > already know that we should keep all app images app/assets/images folder > and css in app/assets/stylesheets. This is what we follow. > > > > However some plugins use images and keep them in parallel to CSS > file.(images and CSS in same folder/level) > > > > So my question is: (We use Asset Pipeline) > > > > • Is it a good practice to keep images of plugin in parallel to > CSS file? (I am hoping it''s good thing) > > • If not, then developer has to change the image paths in entire > css file (if putting plugin images inapp/assets/images), Which I think is > not helpful for future in case you plan to upgrade those plugins. > > Thanks. > > > > > > You might want to put these in the app/vendor/plugin_name/assets folder > tree, so you can keep them separate from your application''s own code. If > these stylesheets are written with "awareness" of a folder hierarchy, like > maybe with ../images/icon.png style references to images, then you may have > trouble with the asset pipeline. I just ran into that in a project here, > and had to give up and let the "magic" work by removing all prefixes. Once > I did that, and just referenced url(icon.png) in my CSS, everything just > worked. (icon.png was in the app/assets/images folder, the stylesheet > referencing it was in the app/assets/stylesheets folder.) > > Walter > > > -- > > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > > To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:>. > > > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/OMfFgRvVr1EJ. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/U3G23LMF4dcJ. For more options, visit https://groups.google.com/groups/opt_out.
Walter Lee Davis
2013-Apr-13 16:12 UTC
Re: Where to put plugin images in Rails application?
On Apr 13, 2013, at 10:40 AM, deepak wrote:> Thanks Walter. > > So in your opinion it is always good to write css without folder prefixes. Am I getting you right here?I''d never done that until this week, but then I am extremely late to the asset pipeline party. I have always written mine with the ../images prefix, because that was what you needed in the public folder. But when I tried doing that, and discovered it didn''t work, I just bailed and put the reference in without the prefix and discovered that it worked fine that way, without any need for the asset_path helper and css.erb or anything else. Walter> > -deepak > > On Saturday, April 13, 2013 7:40:36 PM UTC+5:30, Walter Lee Davis wrote: > > On Apr 13, 2013, at 7:24 AM, deepak wrote: > > > Originally posted here: http://stackoverflow.com/questions/15986969/where-to-put-plugin-images-in-rails-application > > > > We use handful of plugins in our Rails application(Rails 3.2.1). As we already know that we should keep all app images app/assets/images folder and css in app/assets/stylesheets. This is what we follow. > > > > However some plugins use images and keep them in parallel to CSS file.(images and CSS in same folder/level) > > > > So my question is: (We use Asset Pipeline) > > > > • Is it a good practice to keep images of plugin in parallel to CSS file? (I am hoping it''s good thing) > > • If not, then developer has to change the image paths in entire css file (if putting plugin images inapp/assets/images), Which I think is not helpful for future in case you plan to upgrade those plugins. > > Thanks. > > > > > > You might want to put these in the app/vendor/plugin_name/assets folder tree, so you can keep them separate from your application''s own code. If these stylesheets are written with "awareness" of a folder hierarchy, like maybe with ../images/icon.png style references to images, then you may have trouble with the asset pipeline. I just ran into that in a project here, and had to give up and let the "magic" work by removing all prefixes. Once I did that, and just referenced url(icon.png) in my CSS, everything just worked. (icon.png was in the app/assets/images folder, the stylesheet referencing it was in the app/assets/stylesheets folder.) > > Walter > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/OMfFgRvVr1EJ. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/U3G23LMF4dcJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Hey guys, I''m having trouble testing a helper that uses content_for. I am using test::unit and hitting a road block. below is my code and below that is the error I am hitting. Any help would be much appreciated. Matt -- my helper def -- def page_title(title) content_for(:title) { "#{title} | my title" } end -- my test -- test "displays page title" do assert_equal "my test | my title", page_title("my test") end NoMethodError: undefined method `append'' for nil:NilClass -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.