Hi everyone, is it possible to add a controller into the lib folder? I tried but it doesn''t seem to work... Is it because it''s not loaded? Thanks! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You could add foo.rb into lib/modues and then where ever you want to access those methods you would need to include that file. require ''lib/modules/foo.rb'' include foo --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Why do you want to put a controller in the lib folder? That is what the controllers folder is for. 2009/3/27 Alex <afolgueras-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> > Hi everyone, is it possible to add a controller into the lib folder? I > tried but it doesn''t seem to work... Is it because it''s not loaded? > > Thanks! > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi all, here is my situation: My company recently adopted RoR for all its Web Projects. We currently have 3 major projects in development. I''m searching for a way to share between all our projects everything that we have in common. Currently I identified a few models, controllers and libraries that all our projects use. All of these files are duplicated in each of our different projects. The way I see it, I have 2 options: 1) Build a gem out of all the common files and install it on each project. What I dislike about this option is that I will have to update the gem every time something new is added to the gem, and this will happen very frequently... 2) Create a SVN repository that contains all of what is common between the projects. I could then include this repository from the projects repository using an external link. Conceptually this is my best solution because a simple ''update'' would be enough to synchronize everything but my problem is "How do I do that"? For example, the ''lib'' directory of my project could point on the external link. But how will my project "know" to import my models in the app/models directory and my controllers in the app/controllers? Is that even possible? I would appreciate your thoughts on this. Thanks! On 27 mar, 17:32, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Why do you want to put a controller in the lib folder? That is what the > controllers folder is for. > > 2009/3/27 Alex <afolgue...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > > > Hi everyone, is it possible to add a controller into the lib folder? I > > tried but it doesn''t seem to work... Is it because it''s not loaded? > > > Thanks!- Masquer le texte des messages précédents - > > - Afficher le texte des messages précédents ---~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
I''ve never used them before, but you can look into using Rails Engines "The engines plugin enhances Rails’ own plugin framework, making it simple to share controllers, helpers, models, public assets, routes and migrations in plugins." http://rails-engines.org/introduction On Mar 27, 4:51 pm, Alex <afolgue...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, here is my situation: My company recently adopted RoR for all > its Web Projects. We currently have 3 major projects in development. > I''m searching for a way to share between all our projects everything > that we have in common. Currently I identified a few models, > controllers and libraries that all our projects use. All of these > files are duplicated in each of our different projects. > > The way I see it, I have 2 options: > > 1) Build a gem out of all the common files and install it on each > project. What I dislike about this option is that I will have to > update the gem every time something new is added to the gem, and this > will happen very frequently... > > 2) Create a SVN repository that contains all of what is common between > the projects. I could then include this repository from the projects > repository using an external link. Conceptually this is my best > solution because a simple ''update'' would be enough to synchronize > everything but my problem is "How do I do that"? For example, the > ''lib'' directory of my project could point on the external link. But > how will my project "know" to import my models in the app/models > directory and my controllers in the app/controllers? Is that even > possible? > > I would appreciate your thoughts on this. > > Thanks! > > On 27 mar, 17:32, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > Why do you want to put a controller in the lib folder? That is what the > > controllers folder is for. > > > 2009/3/27 Alex <afolgue...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > Hi everyone, is it possible to add a controller into the lib folder? I > > > tried but it doesn''t seem to work... Is it because it''s not loaded? > > > > Thanks!- Masquer le texte des messages précédents - > > > - Afficher le texte des messages précédents ---~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
I''ll have a look at it, thank you very much for your response! On 27 mar, 20:33, Andrew <awa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve never used them before, but you can look into using Rails Engines > "The engines plugin enhances Rails’ own plugin framework, making it > simple to share controllers, helpers, models, public assets, routes > and migrations in plugins." > > http://rails-engines.org/introduction > > On Mar 27, 4:51 pm, Alex <afolgue...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi all, here is my situation: My company recently adopted RoR for all > > its Web Projects. We currently have 3 major projects in development. > > I''m searching for a way to share between all our projects everything > > that we have in common. Currently I identified a few models, > > controllers and libraries that all our projects use. All of these > > files are duplicated in each of our different projects. > > > The way I see it, I have 2 options: > > > 1) Build a gem out of all the common files and install it on each > > project. What I dislike about this option is that I will have to > > update the gem every time something new is added to the gem, and this > > will happen very frequently... > > > 2) Create a SVN repository that contains all of what is common between > > the projects. I could then include this repository from the projects > > repository using an external link. Conceptually this is my best > > solution because a simple ''update'' would be enough to synchronize > > everything but my problem is "How do I do that"? For example, the > > ''lib'' directory of my project could point on the external link. But > > how will my project "know" to import my models in the app/models > > directory and my controllers in the app/controllers? Is that even > > possible? > > > I would appreciate your thoughts on this. > > > Thanks! > > > On 27 mar, 17:32, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > Why do you want to put a controller in the lib folder? That is what the > > > controllers folder is for. > > > > 2009/3/27 Alex <afolgue...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > Hi everyone, is it possible to add a controller into the lib folder? I > > > > tried but it doesn''t seem to work... Is it because it''s not loaded? > > > > > Thanks!- Masquer le texte des messages précédents - > > > > - Afficher le texte des messages précédents - > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Colin Law wrote:> Why do you want to put a controller in the lib folder? That is what the > controllers folder is for. > > 2009/3/27 Alex <afolgueras-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>You could create a plugin that defines controllers, models, etc so that you can more easily share code amongst various apps. I saw that idea yesterday in the rails guides. Instead of generating a controller a plugin could define one, and people could simply overwrite the actions they need to tweak and keep the rest of the controller code untouched. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---