Hi, I have an app where I have both Facebook controllers and normal Rails controllers side by side; but Facebooker likes to set ActionController::Base.asset_host = callback_url; for my app I moved that into my facebook controller but still in my "normal app" controller it still have asset_host == callback_url. Well -- technically that''s only true if both controllers are loaded. Should asset_host be declared as class_inherited_accessor (rather than cattr_accessor) -- or am I being too picky about wanting it to be correct when both controllers are loaded? - Jacob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
matthewrudyjacobs@gmail.com
2009-Feb-08 15:12 UTC
Re: ActionController::Base.asset_host inheritance
I like the idea of having apache setup to deal with the facebook and web bits of the applications seperately. two different VirtualHosts set up in apache. facebook.mydomain.com and www.mydomain.com thereby you can balance load between the two installations of the app, and avoid a spike in Facebook requests killing your whole application. Then you can pass an environment variable to the server. SetEnv IS_FACEBOOK true And use this in your code to determine whether to set the asset_host "if ENV["IS_FACEBOOK"]" or something. But as a simple alternative, it probably makes sense for asset_host to be a class_inherited_accessor. :) On Feb 8, 8:33 am, Jacob Refstrup <jacob.refst...@hp.com> wrote:> Hi, > > I have an app where I have both Facebook controllers and normal Rails > controllers side by side; but Facebooker likes to set > ActionController::Base.asset_host = callback_url; for my app I moved > that into my facebook controller but still in my "normal app" controller > it still have asset_host == callback_url. Well -- technically that''s > only true if both controllers are loaded. > > Should asset_host be declared as class_inherited_accessor (rather than > cattr_accessor) -- or am I being too picky about wanting it to be > correct when both controllers are loaded? > > - Jacob--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
I like that. :) Maybe if you provide a patch, which might be easy, it could go into core. On Feb 8, 9:33 am, Jacob Refstrup <jacob.refst...@hp.com> wrote:> Hi, > > I have an app where I have both Facebook controllers and normal Rails > controllers side by side; but Facebooker likes to set > ActionController::Base.asset_host = callback_url; for my app I moved > that into my facebook controller but still in my "normal app" controller > it still have asset_host == callback_url. Well -- technically that''s > only true if both controllers are loaded. > > Should asset_host be declared as class_inherited_accessor (rather than > cattr_accessor) -- or am I being too picky about wanting it to be > correct when both controllers are loaded? > > - Jacob--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
> Should asset_host be declared as class_inherited_accessor (rather than > cattr_accessor) -- or am I being too picky about wanting it to be > correct when both controllers are loaded?It wouldn''t be *quite* that easy as we cache the calls to path_to_image etc. So while you changed the value, you may not see that reflected in the generated markup. So the simple solution won''t work. A more full-featured solution would be to also move that cache into an inheritable accessor, but that would likely use up a lot of memory. You could also investigate making the asset caching configured independently of the general caching setup, and then turn it off if you wanted to override the settings. -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---