Hi, I''ve just found myself in charge of maintaining and developing a rails web application at my company. It''s a newbish question as I have pretty much no experience with rails before. The problem is that although I change a model file, app/models/template.rb, the web application doesn''t update with the change. In fact, nothing I do to the file seems to affect the application - I even moved it to a different directory, and the application still behaves as before. The application runs with the memcached and the acts_as_cached plugin, but that particular model file isn''t specified to be cached. So, any tips how I can make my changes to the model file apply to the application? BR /Markus -- 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 -~----------~----~----~----~------~----~------~--~---
Markus Svennerstål wrote:> I''ve just found myself in charge of maintaining and developing a rails > web application at my company. It''s a newbish question as I have pretty > much no experience with rails before. The problem is that although I > change a model file, app/models/template.rb, the web application doesn''t > update with the change. In fact, nothing I do to the file seems to > affect the application - I even moved it to a different directory, and > the application still behaves as before. > > The application runs with the memcached and the acts_as_cached plugin, > but that particular model file isn''t specified to be cached. So, any > tips how I can make my changes to the model file apply to the > application?If you are modifying the application in production, the model class won''t be reloaded unless you stop and restart the server. In the development configuration of the Rails environment, model classes (and many others) are automatically reloaded when they change. Now, if you are modifying the application code on the production server, you have a whole other mess of problems to deal with. You really need to study up on best practices for server development and maintenance. At a minimum you need to develop on a machine that isn''t your production server, store your code in a versioned repository such as Subversion, and deploy only a tested revision to production. Anything less is eventually going to end up with you in a lot of pain. If you are already doing allnthat, then perhaps your development environment somehow thinks it is a production one. Look in config.environment.rb near the top of the file and see if the line ENV[''RAILS_ENV''] ||= ''production'' is active. Commenting it out might fix things for you. If that doesn''t help, maybe you are using a script that is setting RAILS_ENV to production. Or the previous developer may have hacked the code in some way that disables class reloading. In the file config/environments/development.rb, there should be a line that says config.cache_classes = false If that isn''t there or sets it to true, fix it. Good luck. -- Josh Susser http://blog.hasmanythrough.com -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Markus Svennerstål wrote:> Hi, > > I''ve just found myself in charge of maintaining and developing a rails > web application at my company. It''s a newbish question as I have pretty > much no experience with rails before. The problem is that although I > change a model file, app/models/template.rb, the web application doesn''t > update with the change. In fact, nothing I do to the file seems to > affect the application - I even moved it to a different directory, and > the application still behaves as before. >Markus, Also keep in mind that only ActiveRecord::Base descendants (in Rails 1.1 at least) are reloaded automatically. If you model doesn''t extend ActiveRecord::Base, maybe it isn''t getting reloaded automatically. I''m not sure if that behavior still exists in Rails 1.2, since I know that they modified the reloading behavior in Rails 1.2. Wes -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wes Gamble wrote:> Markus Svennerstål wrote: >> Hi, >> >> I''ve just found myself in charge of maintaining and developing a rails >> web application at my company. It''s a newbish question as I have pretty >> much no experience with rails before. The problem is that although I >> change a model file, app/models/template.rb, the web application doesn''t >> update with the change. In fact, nothing I do to the file seems to >> affect the application - I even moved it to a different directory, and >> the application still behaves as before. >> > > Markus, > > Also keep in mind that only ActiveRecord::Base descendants (in Rails 1.1 > at least) are reloaded automatically. If you model doesn''t extend > ActiveRecord::Base, maybe it isn''t getting reloaded automatically. I''m > not sure if that behavior still exists in Rails 1.2, since I know that > they modified the reloading behavior in Rails 1.2. > > WesHi, thanks to both of you for the helpful answers. I have set up a development environment - but it was running in production mode, so that was the core of the problem. Changed it to development mode, and now it works much better. As for how to properly handle server development and maintenance, I have some vague ideas about how it should be done. Right now I have two environments - a production environment and a development environment. I''m currently trying to get the old CVS repository working; in the meanwhile I''ll just use a script to manually migrate my changes and create restore points whenever I do so. One question though: I run my development and production servers as different virtual hosts on the same apache server. It''s been working fine so far, but is there any inherent dangers with that setup, like the development server crashing / hanging the web server? Many thanks /Markus -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Markus Svennerstål wrote:> One question though: I run my development and production servers as > different virtual hosts on the same apache server. It''s been working > fine so far, but is there any inherent dangers with that setup, like the > development server crashing / hanging the web server?I wouldn''t think so, although I don''t claim to be an expert in this realm. But however you deploy, your development and production servers will definitely be running your Rails app in completely separate Ruby processes so they won''t hurt the Apache server. If you do something that hangs/brings down the entire box, then of course, you will affect both environments. Wes -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---