On Sat, Jun 6, 2009 at 5:54 PM, J. D.<[email protected]> wrote: > 1. Where do custom .rb files go inside of my rails project? (for > instance I understand the MVC but with a rake task - in my brain it's > outside of the project and I'm not sure how it is supposed to > communicate with controllers or pull/associate variables from those > areas. >
This custom file should be called scraper.rb and should be placed at the /lib folder of your application. In a rake task you don't really access or call controllers, you just run the task, which is telling the scrapper to load the data and then save it to the DB. > 2. With my custom .rb I'm also requiring 'hpricot'. Is there anything > special I need to do with a .rake file to make sure that it knows to > pull this gem? And, if I export to my real site, how do I ensure that > hpricot is loaded there too? In otherwords, what expectations should I > be relying on? > You don't need to do anything else, Rails will automatically enable rubygems and by requiring hpricot you will tell it to load the gem. > 3. When I run a rake task and need to communicate with my database (for > uploading purposes) is there an easy way to do this? Can I utilize > .rake with my DB inside of my rails environment? Or, are rake tasks > completely seperate and distinct and need to be considered outside of > scope? > Now you have to learn the Rails database access framework, ActiveRecord, you should probably find plenty of material about it. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://codeshooter.wordpress.com/ (en) --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

