[Rails] Re: send_file example code -- permissions?
Glad I could help. James Stradling was the guy that actually wrote that particular bit of code. On Nov 2, 2008, at 11:41 AM, Jeff Pritchard [EMAIL PROTECTED] wrote: Walter, this worked great. Thanks a million! jp Walter McGinnis wrote: Here's some example code that covers nginx, apache, or plain old send_file: http://github.com/kete/kete/tree/master/app/controllers/private_files_controller.rb Works with 2.1, haven't tried it with 2.2 RC1 yet. Hope it helps. Cheers, Walter On Fri, Oct 31, 2008 at 2:49 PM, Jeff Pritchard -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Handling multiple domain accounts for accessing a single web app.
On Thu, Jul 3, 2008 at 6:24 PM, jacob v thomas [EMAIL PROTECTED] wrote: hi all, Here is the question, Is there a way to set multiple domain name for accessing a single rails application, Bump. Is there a way to handle multiple domains including being able to use different templates for different domains? --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Getting started with ROR when you come from the desktop world with no experience in developing web application
Tarek - I went through what you're about to go through and actually enjoyed the process :) I hadn't programmed anything for 12 years Buy the Ruby Pickaxe book. Buy Agile Web Development with Rails (wait for next edition) Find a hosting company that supports RoR if you need hosting. Use mod_rails to deploy. It took me a few iterations to understand the whole Model-View- Controller idea. I know zero about HTTP, DHTML, XML, DOM I know a very, very little about Javascript You need to start understanding CSS at some point but it comes later and as you need it, I found. Work hard to understand Ruby. And just abandon the for loop as quickly as you can. The learning curve was steep for me but it's fun to learn new stuff. Here's what I managed to produce and I started in February 2008. I'm just starting to experiment with some of the Ajax stuff. http://www.assetcorrelation.com On Nov 1, 10:44 am, Tarek Demiati [EMAIL PROTECTED] wrote: I’m very interested in starting with ROR, however I do not know where to start, I’ve a background as a developer of desktop application, the web is new to me, there seems to be a lot of things to master in order to become an efficient ROR developer, So I’m a bit confuse on what should I learn first : HTTP,DHTML,XML,DOM,Javascript, CSS and then Ruby on Rails ? I’m aware that ROR does many of the low level dirty work for you, so it hides the complexity from you So my questions are : 1/ Do you think someone can be a good ROR developer without mastering the following technologies : HTTP,DHTML,XML,DOM,Javascript, CSS 2/ Which books would you advise me to read (ideally in chronological order) 3/ Does the learning curve can be pretty steep for someone who do not come from a web development culture (ie : Java/J2EE) 4/ I would also appreciate book recommendations for : HTTP,DHTML,XML,DOM,Javascript, CSS, Ruby, Rails Best Regards from France, Tarek Demiati --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Michael Kahle wrote: Super! Thanks so much. It worked perfectly. The only thing I changed from your example was to handle the update as a transaction. Updating @registration and @customer with the .attributes method did the trick perfectly. I am off to experiment with the validates_associated :customer. Could you explain a little more what you changed and why. One little improvement: Use save_without_validation! to prevent the validations from being run twice. -- Rails Wheels - Find Plugins, List Sell Plugins - http://railswheels.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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: rspec issues
expected new, got /Users/elise/Rails/myapp/app/views/user/profiles/ new.html.erb So it expects the full path. That can't be right ? nope, it expects new and gets the full path instead. what's your render command? render :action = :new Typical ruby thing. should be tests for the two strings are an identical string object (one and the same thingy in memory) use: assigns['page'].menu.should eql(home alone) OK, thanks Elise --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: rspec issues
b) makes sense, though it is surprising: I mean developer-defined errors are usually Exceptions, and should be caught too, no ? I need to pick up my ruby book again. Elise On Oct 31, 10:05 am, James Mead [EMAIL PROTECTED] wrote: Hi Elise, 2008/10/31 [EMAIL PROTECTED] [EMAIL PROTECTED] - mocking (ok, i'm using mocha, so maybe it isn't rspec): i make a mailer raise an error like this: DummyMailer.stubs(:deliver_invitation).raises(Exception) and in my code, surround this with begin ... rescue, the exception is not caught ! a) Are you sure deliver_invitation is being called? b) Are you using just a default rescue clause? This will only rescue StandardError's and descendants of StandardError. Exception is not a descendant of StandardError. I think Mocha raises a StandardError by default, so if you change your stubbing as follows, a default rescue clause will work... DummyMailer.stubs(:deliver_invitation).raises If you are still seeing unexpected behaviour, come over to the Mocha mailing list [1] and we'll see if we can help. -- James.http://blog.floehopper.org [1]http://groups.google.com/group/mocha-developer --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: rspec issues
b) makes sense, though it is surprising: I mean developer-defined errors are usually Exceptions, and should be caught too, no ? I need to pick up my ruby book again. Elise On Oct 31, 10:05 am, James Mead [EMAIL PROTECTED] wrote: Hi Elise, 2008/10/31 [EMAIL PROTECTED] [EMAIL PROTECTED] - mocking (ok, i'm using mocha, so maybe it isn't rspec): i make a mailer raise an error like this: DummyMailer.stubs(:deliver_invitation).raises(Exception) and in my code, surround this with begin ... rescue, the exception is not caught ! a) Are you sure deliver_invitation is being called? b) Are you using just a default rescue clause? This will only rescue StandardError's and descendants of StandardError. Exception is not a descendant of StandardError. I think Mocha raises a StandardError by default, so if you change your stubbing as follows, a default rescue clause will work... DummyMailer.stubs(:deliver_invitation).raises If you are still seeing unexpected behaviour, come over to the Mocha mailing list [1] and we'll see if we can help. -- James.http://blog.floehopper.org [1]http://groups.google.com/group/mocha-developer --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Do I require a polymorphic link??
Hi there. I'm very new to RoR, and I'm writing my first 'web app' and already I think I need a one-to-many polymorphic join. The reason I'm writing this is because it is causing me a real headache. After sitting at my pc for what seems like 4 four solid days, I'm not getting anywhere. Here's the scenario; A user profile photo will be displayed based on which profile he/she has selected. There are three different types. a) Monthly photo b) Daily photo c) Specific date in year. Each of these are all different tables because they hold slightly different types of data. So 'Monthly' would have at most 12 rows per user, whereas 'daily photos' and 'specific date' tables would have an unlimited amount of rows of data assigned to a user. Does anyone know how best to go about to achieve this? I've tried using the example of the polymorphic join in AWDR V2, but it seems to be a one 2 one relationship. I can't seem to get the One 2 many to work at all. I suppose my question is this; Can anyone help with One to Many polymorpphic joins before the last of my hair falls out! --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Mark Reginald James wrote: Michael Kahle wrote: @snowplow_registration.update_attributes!(params[:snowplow_registration]) When the transaction starts, if validation fails on the @snowplow_registration, it doesn't check the validation on my @customer for the fields that were updated. Validation for both works properly when testing separate... but @customer returns to the edit page without passing the changed (params[:customer]) because the failure in the transaction happened before I can call @customer.update_attributes!(params[:customer]). Is there a way to update the model in memory before updating the database? This is one way: def update @snowplow_registration = SnowplowRegistration.find(params[:id]) @customer = @snowplow_registration.customer @snowplow_registration.attributes = params[:snowplow_registration] @customer.attributes = params[:customer] customer_valid = @customer.valid? if @snowplow_registration.valid? customer_valid SnowplowRegistration.transaction do @snowplow_registration.save! @customer.save! flash[:notice] = 'Snow Plow Registration was updated.' redirect_to(@snowplow_registration) end else render :action = :edit end end If you add validates_associated :customer to the SnowplowRegistration class you only then need to check the validity of @snowplow_registration, but the validity of the customer will now be checked whenever a SnowplowRegistration instance is saved. Super! Thanks so much. It worked perfectly. The only thing I changed from your example was to handle the update as a transaction. Updating @registration and @customer with the .attributes method did the trick perfectly. I am off to experiment with the validates_associated :customer. Thanks again. Michael -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Michael Kahle wrote: I hope I'm explaining this correctly. Be gentle. Noob here. :) Ideas on how to solve this? Kind of a chicken or the egg scenario. Check out this update function in my controller: def update @snowplow_registration = SnowplowRegistration.find(params[:id]) @customer = Customer.find(@snowplow_registration.customer) SnowplowRegistration.transaction do @snowplow_registration.update_attributes!(params[:snowplow_registration]) @customer.update_attributes!(params[:customer]) flash[:notice] = 'Snow Plow Registration was successfully updated.' redirect_to(@snowplow_registration) end rescue ActiveRecord::RecordInvalid = e @customer.valid? render :action = edit end When the transaction starts, if validation fails on the @snowplow_registration, it doesn't check the validation on my @customer for the fields that were updated. Validation for both works properly when testing separate... but @customer returns to the edit page without passing the changed (params[:customer]) because the failure in the transaction happened before I can call @customer.update_attributes!(params[:customer]). Is there a way to update the model in memory before updating the database? This is one way: def update @snowplow_registration = SnowplowRegistration.find(params[:id]) @customer = @snowplow_registration.customer @snowplow_registration.attributes = params[:snowplow_registration] @customer.attributes = params[:customer] customer_valid = @customer.valid? if @snowplow_registration.valid? customer_valid SnowplowRegistration.transaction do @snowplow_registration.save! @customer.save! flash[:notice] = 'Snow Plow Registration was updated.' redirect_to(@snowplow_registration) end else render :action = :edit end end If you add validates_associated :customer to the SnowplowRegistration class you only then need to check the validity of @snowplow_registration, but the validity of the customer will now be checked whenever a SnowplowRegistration instance is saved. -- Rails Wheels - Find Plugins, List Sell Plugins - http://railswheels.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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Problem with acts_as_attachment
HI.. I used acts_as_attachment plugin ot upload a picture, but it return this ERROR when uploading. pls help stucked.. error:- undefined method `after_attachment_saved_callback_chain' --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Mark Reginald James wrote: Michael Kahle wrote: Super! Thanks so much. It worked perfectly. The only thing I changed from your example was to handle the update as a transaction. Updating @registration and @customer with the .attributes method did the trick perfectly. I am off to experiment with the validates_associated :customer. Could you explain a little more what you changed and why. I will do my best; it certainly helps to re-enforce what I've learned. In your example you provided, what was to me, a novel idea in terms of updating the @snowplow_registration and @customer objects. When these objects were first created in the update method, they had the properties of a newly fetched record from the database. It wasn't until I called on each of these: @snowplow_registration.update_attributes!(params[:snowplow_registration]) @customer.update_attributes!(params[:customer]) respectively, did the newly created objects, instantiated at the beginning, take on the properties of my submitted form. My problem was that when the transaction failed during the first update, I would never see the newly created @customer object updated with my form information. By calling the .attributes = params[] method on each of these BEFORE I started my transaction I now had in memory the new form data I entered to pass to my rescue catch. In your code, you check the Customer object before submitting it to be written. I was about to write about how important it was for me to do this update in a transaction because of the possibility of the database failing in between writes and how your code didn't account for that. I glanced over your code when I saw: if @snowplow_registration.valid? customer_valid and simply assumed you were doing a standard non-transactional save to the database. Now that I'm inspecting this more closely, I see that you did-in-fact keep this a transactional operation. Here is the code I am using now: def update @snowplow_registration = SnowplowRegistration.find(params[:id]) @customer = @snowplow_registration.customer @snowplow_registration.attributes = params[:snowplow_registration] @customer.attributes = params[:customer] SnowplowRegistration.transaction do @snowplow_registration.update_attributes!(params[:snowplow_registration]) @customer.update_attributes!(params[:customer]) flash[:notice] = 'Snow Plow Registration was successfully updated.' redirect_to(@snowplow_registration) end rescue ActiveRecord::RecordInvalid = e @customer.valid? render :action = edit end As you can see the only changes I've made from my first post are: 1) I originally had in my 3rd line: @customer = Customer.find(@snowplow_registration.customer) and changed it to what you had: @customer = @snowplow_registration.customer I thought your way looked cleaner. 2) I then added: @snowplow_registration.attributes = params[:snowplow_registration] @customer.attributes = params[:customer] as I explained above, this did the trick to update BEFORE my transaction occurred, the @customer and @registration classes. I had to change nothing else from my original example as the checks are already in place. One little improvement: Use save_without_validation! to prevent the validations from being run twice. Another good thought, however what I am using now doesn't have the same duplication as your suggested code does. Unless of course when I call the attributes method it runs a check then as well. I'm not sure that is the case. I'll have to think about that. Thank you so much for this discussion and all the wonderful new tidbits you've showed me. Like I said above, this discussion just helps reinforce the things that I am learning. -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: rspec issues
2008/11/2 [EMAIL PROTECTED] [EMAIL PROTECTED] b) makes sense, though it is surprising: I mean developer-defined errors are usually Exceptions, and should be caught too, no ? I need to pick up my ruby book again. It's a common developer mistake to derive new exception classes from Exception, rather than StandardError. Such exception classes will not be rescued by a default rescue clause. -- James. http://blog.floehopper.org --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Getting started with ROR when you come from the desktop world with no experience in developing
Andy wrote: Buy the Ruby Pickaxe book. Buy Agile Web Development with Rails (wait for next edition) Find a hosting company that supports RoR if you need hosting. Use mod_rails to deploy. I bought both of these books as PDF's from the Pragmatic Programmers site. I have dual monitors so I really liked this setup. Textmate in one window and my PDF in another. I also have access to a color printer and a binder at work. So I printed out the Active Record, Action Controller, and Action View chapters and bound them into 3 separate little books. They fit nicely into my laptop case and has been a really neat tool to help me reinforce what is going on in these 3 important pieces of rails. I have to think about the MVC design pattern to grab the right book to find what I am looking for. The 3rd edition is out in PDF as a beta from their site now if you want to get started; same with the new Pickaxe book. Good luck! I'm having a great time. :) -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Hosting Email
How do folks handle email for their web startup? I have my rails app handling all of its email chores beautifully using sendmail and ActionMailer. New Account Confirmation, Forgotten Password Email, Monthly Newsletter, etc. DNS points to our server using MX records and we're good to go. My issue is how do I handle my corporate email -- employee email, etc? I would really like to use google's private label hosing capability (i'm talking about google hosting [EMAIL PROTECTED] NOT [EMAIL PROTECTED]) as the Mail User Agent (MUA). However, I can't figure out how to get employee mail to bypass our web app and go to the Mail User Agent while still maintaining the MX record link to our web app for the web apps business(again, preferably google's corporate email handling). It's as if I need two sets of MX records -- one for the web app traffic and one for our corporate/employee email. What have other folks done? Am I missing something fundamental? For example, is there a way to have sendmail accept all email but then bounce the employee email over to an outside MUA (again, maybe google)? -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] error message
When I run a test, I get the error message: FormatError: Bad data for Story fixture named two (nil). What should I do about it? --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Michael Kahle wrote: did-in-fact keep this a transactional operation. Here is the code I am using now: def update @snowplow_registration = SnowplowRegistration.find(params[:id]) @customer = @snowplow_registration.customer @snowplow_registration.attributes = params[:snowplow_registration] @customer.attributes = params[:customer] SnowplowRegistration.transaction do @snowplow_registration.update_attributes!(params[:snowplow_registration]) @customer.update_attributes!(params[:customer]) flash[:notice] = 'Snow Plow Registration was successfully updated.' redirect_to(@snowplow_registration) end rescue ActiveRecord::RecordInvalid = e @customer.valid? render :action = edit end Michael, you no longer have to use update_attributes!, because this is the same as attributes= followed by save! One little improvement: Use save_without_validation! to prevent the validations from being run twice. Another good thought, however what I am using now doesn't have the same duplication as your suggested code does. Unless of course when I call the attributes method it runs a check then as well. I'm not sure that is the case. I'll have to think about that. It's the validation code that's run twice, once at valid? and once at save!, which you'll see if you put a logger.debug call in say a Customer.validate method. This usually doesn't cause problems, only unnecessary extra CPU load. -- Rails Wheels - Find Plugins, List Sell Plugins - http://railswheels.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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Michael Kahle wrote: Ooo. Another thought. I noticed that you are doing a transaction without using the rescue catch. If something else goes wrong, besides validation, you will never know what happened! :) Unless you have a pre-save model callback preventing the save for a specific reason by returning false, that you wish to signal to the user, such exceptions are better handled by an app-wide catcher. -- Rails Wheels - Find Plugins, List Sell Plugins - http://railswheels.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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Getting started with ROR when you come from the desktop world with no experience in developing web application
On Nov 1, 5:44 pm, Tarek Demiati [EMAIL PROTECTED] wrote: 2/ Which books would you advise me to read (ideally in chronological order) I would read the Pickaxe first and get a good grip on ruby before moving onto AWDWR 3/ Does the learning curve can be pretty steep for someone who do not come from a web development culture (ie : Java/J2EE) I don't think it's as different as you think. I came to Rails with no web experience. Part of it depends on where you see yourself going. I personally am more of a backend programmer whose frontend happens to be the web, however most of the time I am solving problems that are completely independent from that front end. I leave the graphical design, css and that sort of thing to people who care deeply about those things (it does help to understand what's going on, in particular a healthy understanding of the DOM and javascript is useful if you want a richer interaction than a traditional website. CSS selectors and so on are cool, however I know nothing about making stuff look pretty). Depending on what you want to do, that may or may not be an option. Fred --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: error message
On 2 Nov 2008, at 18:53, Delirium tremens wrote: When I run a test, I get the error message: FormatError: Bad data for Story fixture named two (nil). What should I do about it? sounds like your stories.yml fixture file has something fishy in it. Fred --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Two Actions for One Click
On 2 Nov 2008, at 03:32, tailormade wrote: I have a list where the user clicks on an item and the details about that item are shown. Simple. No problem. However, I also need to make a javascript call to highlight information in a java applet corresponding to the item being displayed. I know I am missing something simple, but how can I both display the details and make the javascript call to the applet's API based on that one user click? assuming this is a link_to_remote, one or more of the :before, :after, :onComplete or :onSuccess options may be appropriate. Fred --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] list problem?
I haven't received any posts from the list since yesteday morning. I'm posting this from the google interface. Could someone with admin rights check into this? Thanks, Bill --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: error message
My stories.yml file did not have identation. I added it, with 2 spaces, then it worked! On 2 nov, 17:08, Frederick Cheung [EMAIL PROTECTED] wrote: On 2 Nov 2008, at 18:53, Delirium tremens wrote: When I run a test, I get the error message: FormatError: Bad data for Story fixture named two (nil). What should I do about it? sounds like your stories.yml fixture file has something fishy in it. Fred --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: list problem?
On 2 Nov 2008, at 19:12, bill walton wrote: I haven't received any posts from the list since yesteday morning. I'm posting this from the google interface. Could someone with admin rights check into this? I've got mail from the list. the admin panel says that mail to you is bouncing (and hence it has stopped trying for now). Apparently your domain thought it was spam: Technical details of permanent failure: Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 Message identified as SPAM - Please visit http://www.charter.com/postmaster (state 18). Thanks, Bill --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Getting started with ROR when you come from the desktop world with no experience in developing web application
If you already have experience with software development and you have a comfortable work environment (i.e. OS, editor, web browser,...) then I say go for it. There are so many related protocols et.al. dumped into the interweb (HTML, XHTML, XML, blah blah blah) that if you try to bone up on all of them before you start you 1) won't start or 2) will start so far from RoR that you'll likely forget why you wanted to in the first place. There is definitely a Unix bias here (read MacOSx and Linux in it's many flavors) that will give you a slight penalty if you're working in the MS world (there are those of us who think that's only fair...;-) I think there are two ways to approach the learning curve. The first is to go the study method: 1) Pickaxe == AgileWeb == AdvancedRailsRecipes = DeployingRailsApps I would include Obie Fernandez' TheRailsWay in this list. This is a very good path for the patient and, even if you don't follow it (the one true way) religiously, the books should be always at hand in some form for reference. 2) For the impatient, take a look at RailsSpace by Hartl and Prochazka. You can follow along the development of a fairly simple project and get a good feel for the way the big ideas (REST, MVC, DRY, buzz buzz buzz) look in code. My guess is that some combination of the two is good for just about anyone. You'll also want to get very familiar with various chat groups - this is a good one. Just monitoring the conversations will give you a good idea of what the current active issues are. One added thing is some kind of IDE or just a smart editor. I've always found that emacs is a fine tool to have around, NetBeans (by Sun) provides a fairly full IDE that runs on different platforms. NetBeans is an active area of development itself with real work being done to support RoR. Most important is have fun. Rick On Nov 1, 7:44 am, Tarek Demiati [EMAIL PROTECTED] wrote: I’m very interested in starting with ROR, however I do not know where to start, I’ve a background as a developer of desktop application, the web is new to me, there seems to be a lot of things to master in order to become an efficient ROR developer, So I’m a bit confuse on what should I learn first : HTTP,DHTML,XML,DOM,Javascript, CSS and then Ruby on Rails ? I’m aware that ROR does many of the low level dirty work for you, so it hides the complexity from you So my questions are : 1/ Do you think someone can be a good ROR developer without mastering the following technologies : HTTP,DHTML,XML,DOM,Javascript, CSS 2/ Which books would you advise me to read (ideally in chronological order) 3/ Does the learning curve can be pretty steep for someone who do not come from a web development culture (ie : Java/J2EE) 4/ I would also appreciate book recommendations for : HTTP,DHTML,XML,DOM,Javascript, CSS, Ruby, Rails Best Regards from France, Tarek Demiati --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Mark Reginald James wrote: Michael Kahle wrote: Another good thought, however what I am using now doesn't have the same duplication as your suggested code does. Unless of course when I call the attributes method it runs a check then as well. I'm not sure that is the case. I'll have to think about that. It's the validation code that's run twice, once at valid? and once at save!, which you'll see if you put a logger.debug call in say a Customer.validate method. This usually doesn't cause problems, only unnecessary extra CPU load. Ok. I'm confused. If I step through my code line by line it would seem to me that it does the following: 1.) Creates a new object to dump stuff into. 2.) Dumps everything from the form (params) into these new objects. 3.) Begins the transaction. 4.) First updates @snowplow_registration, the ! at the end of the update method forces a check against the model for validation and returns any errors that come from the update. If it doesn't succeed, then it is caught by the rescue case and then checks the @customer object for errors. Does this sound right? It sounds like I might be missing something fundamental here. Thanks for looking. :) -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Mark Reginald James wrote: Michael Kahle wrote: Ooo. Another thought. I noticed that you are doing a transaction without using the rescue catch. If something else goes wrong, besides validation, you will never know what happened! :) Unless you have a pre-save model callback preventing the save for a specific reason by returning false, that you wish to signal to the user, such exceptions are better handled by an app-wide catcher. I'm really not sure what a pre-save model callback is. This is rapidly getting over my head! :) Are you saying that anything caught by rescue is something that you wouldn't want to pass back to the user? Is this because, let's say, in the event of a database failure it would better to send this to a log file or something similar? Is the idea behind what you are saying that we should only be passing validation errors back to the user? This would make sense to me. I'm just far too green with Ruby at this point to even think about that. Thanks again. -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Michael Kahle wrote: Mark Reginald James wrote: Michael Kahle wrote: Ooo. Another thought. I noticed that you are doing a transaction without using the rescue catch. If something else goes wrong, besides validation, you will never know what happened! :) Unless you have a pre-save model callback preventing the save for a specific reason by returning false, that you wish to signal to the user, such exceptions are better handled by an app-wide catcher. I'm really not sure what a pre-save model callback is. This is rapidly getting over my head! :) If a model before_validation, after_validation, or before_save method or block returns false, a valid record won't be saved, but you only get an exception if the saving method ended with an exclamation mark. Are you saying that anything caught by rescue is something that you wouldn't want to pass back to the user? Is this because, let's say, in the event of a database failure it would better to send this to a log file or something similar? Is the idea behind what you are saying that we should only be passing validation errors back to the user? While you can use rescue sections in individual actions to specially handle and inform users about action-specific errors, to prevent duplication it's usually best to have other exceptions handled by a single method in application.rb that informs both the user and the developer than an unexpected error has occurred. e.g. See the exception_notification plugin. -- Rails Wheels - Find Plugins, List Sell Plugins - http://railswheels.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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Returning changed fields when transaction fails...
Michael Kahle wrote: Ok. I'm confused. If I step through my code line by line it would seem to me that it does the following: 1.) Creates a new object to dump stuff into. 2.) Dumps everything from the form (params) into these new objects. 3.) Begins the transaction. 4.) First updates @snowplow_registration, the ! at the end of the update method forces a check against the model for validation and returns any errors that come from the update. If it doesn't succeed, then it is caught by the rescue case and then checks the @customer object for errors. The ! just causes an exception to be raised if the record is invalid, or if saving was prevented by a callback. Here you've already checked that both the records are valid, so you just want to ensure that any other problem causes the propagation of an app-wide exception (which will also rollback the transaction). Also, you have already updated the records from the user-form using attributes=. Therefore you want to use save_without_validation! rather than update_attributes!, save!, or save. -- Rails Wheels - Find Plugins, List Sell Plugins - http://railswheels.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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Strange dependency error after going Ruby1.8.6, Rails 2.1.0 - Ruby1.8.7, Rails 2.1.2
Ok, I tried Rails 2.1.2, 2.1.1 and 2.1.0 The error shows up in all versions. I guess that means it has something to do with the Ruby Update (1.8.6 - 1.8.7)? --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Strange dependency error after going Ruby1.8.6, Rails 2.1.0 - Ruby1.8.7, Rails 2.1.2
On Nov 2, 10:40 pm, Java [EMAIL PROTECTED] wrote: Ok, I tried Rails 2.1.2, 2.1.1 and 2.1.0 The error shows up in all versions. I guess that means it has something to do with the Ruby Update (1.8.6 - 1.8.7)? Typically this happens when you're mixing things that are reloading between requests and things that aren;t (in production nothing is reloaded so this problem can't happen). See http://groups.google.com/group/rubyonrails-core/browse_thread/thread/710868b1292c737f Fred --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] ROR Ubuntu 8.10: Action Controller: Exception caught
System: Virtual Box running Ubuntu 8.10 as guest Fellowed ( http://wiki.rubyonrails.org/rails/pages/RailsOnUbuntu ) to instal RoR Book: Agile Web Development with Rails: Second Edition Issue: (pleas help) I'm creating a simple hello world application as defined on pages 36-40. Generating controller called 'Say'. How to I fix issue below? it returns this error rather then what is supposed to happen according to the book: MissingSourceFile in SayController#hello no such file to load -- sqlite3 RAILS_ROOT: /home/adam/R0R/demo Application Trace | Framework Trace | Full Trace /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:355:in `new_constants_in' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/kernel/requires.rb:7:in `require_library_or_gem' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_or_gem' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:10:in `sqlite3_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in `send' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in `connection=' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:260:in `retrieve_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/query_cache.rb:8:in `cache' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/caching/sql_cache.rb:12:in `perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:529:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:529:in `process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/filters.rb:568:in `process_without_session_management_support' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/session_management.rb:130:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:389:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:149:in `handle_request' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:107:in `dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:104:in `synchronize' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:104:in `dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:35:in `dispatch' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:503:in
[Rails] Re: Getting started with ROR when you come from the desktop world with no experience in developing web application
It depends on what you have interest in doing. For my applications, there database focused. So here is the getting something going in the shortest possible time. 1. Get the Ruby Cookbook fro Oreilly. (Keep on your desk) 2. ProActive Record is another one I would keep handy. 3. Choose a project. 4. Use the following plugins: a. ActiveScaffold b. Tabnav/Widgets 5. Use sqlite to start. (I used oracle to start, but I work in a enterprise) 6. Start your app. The lovely part of using activescaffold, is its highly customizable. So you can go far not writing any dhtml/xml/dom/css. Yes your have a enterprisey looking app, but your have it in short order. I've done apps with 20-30 tables, write a conversion script to import the data, write a generator script to generate controllers and models, and had it up and running and usable in 4 days. It all depends on the type of applications you want to do. You might want to look at mentalpagingspace.blogspot.com lots of experience I've gained in using ruby and rails for large scale corp applications. At this point I feel I can do anything from a Stock trading applications to a MRP/ERP system using ruby on rails. (And can do it in windows or linux). On Nov 2, 1:44 am, Tarek Demiati [EMAIL PROTECTED] wrote: I’m very interested in starting with ROR, however I do not know where to start, I’ve a background as a developer of desktop application, the web is new to me, there seems to be a lot of things to master in order to become an efficient ROR developer, So I’m a bit confuse on what should I learn first : HTTP,DHTML,XML,DOM,Javascript, CSS and then Ruby on Rails ? I’m aware that ROR does many of the low level dirty work for you, so it hides the complexity from you So my questions are : 1/ Do you think someone can be a good ROR developer without mastering the following technologies : HTTP,DHTML,XML,DOM,Javascript, CSS 2/ Which books would you advise me to read (ideally in chronological order) 3/ Does the learning curve can be pretty steep for someone who do not come from a web development culture (ie : Java/J2EE) 4/ I would also appreciate book recommendations for : HTTP,DHTML,XML,DOM,Javascript, CSS, Ruby, Rails Best Regards from France, Tarek Demiati --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: images folder concern when deploying with Capistrano and
Tim McIntyre wrote: I'd watch out for the rm -rf #{release_path}/public/images/users line. I think that would remove all your images. Hi Tim, Thanks for the tip. I've been busy so I haven't tried to do this just yet but I'm sure it would remove the images. The idea is to move the directory/contents to the shared folder prior to deploying with the deploy:symlink task. Thanks again for the tip, I'm sure a lot of people will be grateful for that instead of finding their images gone (though nothing a simple, rollback couldn't fix) :-) -Tony -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: ROR Ubuntu 8.10: Action Controller: Exception caught
try in gnome-terminal sudo gem install sqlite3 or check in synaptic package manager for sqlite3 with ruby then install corresponding packages. -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: stuck on a validates_presence_of unless issue
I must have looked at those API docs 10 times and didn't see it. Would have bitten...and all that. Thanks for the quick response Craig. Worked like a charm. Tom On Nov 1, 9:05 am, Craig Demyanovich [EMAIL PROTECTED] wrote: On Sat, Nov 1, 2008 at 5:29 AM, hoenth [EMAIL PROTECTED] wrote: i have a person object. Persons don't need to have addresses, but if they have any address field value, they must have them all. So I have something like this: validates_presence_of :street_address, :city, :state, :postal_code unless :address_blank? Instead of unless :address_blank? use :unless = :address_blank? since you need to pass options to validates_presence_of as opposed to writing a normal conditional. See the API docs for validates_presence_of for more details if you need them. Regards, Craig --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Ruby and/or Rails Community in Argentina
Hola a Todos, ¿Hay alguna comunidad de usuarios Ruby/Rails en Argentina, de la que ustedes sepan? Hello All, Is there any Ruby/Rails community in Argentina, that you know/heard of? Thanks in advance, -- Rodrigo Fuentealba http://www.thecodekeeper.net/ --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Changing drop_receiving_element behavior to make a GET request instead of POST
Is it possible to specify which HTTP method to use in the drop_receiving_element helper? I'm trying to follow REST best practices in my app. On one page I have the user drop an icon into an area which calls the new representation of a particular resource. However, drop_receiving_element sends the request as POST which is not allowed. How can I change the method so it makes a GET request? --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] set Message-ID header in ActionMailer?
I'm trying to set my own Message-ID when sending mail... not having any luck. It seems that my ID header is overwritten. i've tried both message_id and headers below, nothing seems to work: def setup_email(message, person) @recipients = #{person.email} @from= [EMAIL PROTECTED] @message_id = my-custom-message-id @headers = {'Message-ID' = message.smtp_message_identifier} @sent_on = Time.now @body[:msg] = message.body end any suggestions? --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Handling SOAP XML request and Response
Hi all, I have a SOAP XML request coming from a VB6.0 application, which I have to handle in my ROR application. After the request is handled, i have to parse the request and check the extracted values in the database according to the checking i have to send a Response to the VB6.0 application. Please tell me the procedure how can i used SOAP XML in ROR application for handling these activities. Please help me. Thanks and Regards. Shripad --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Unable to install sqlite3
I am new to Ruby. Try out a web application, but when I tried to access the page, it has the following error (see ERROR 1 below). So I thought I may have not installed sqlite3 and tried downloading sqlite_3-6-4.zip and sqlitedll_3-6-4.zip, unzipped it and place it in ruby's bin directory. Then I run the command: gem install sqlite3-ruby But found myself encounter the another error shown below (see ERROR 2). Any help would by wonderful == ERROR 1 = MissingSourceFile (no such file to load -- sqlite3): C:/Programs2/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `g em_original_require' C:/Programs2/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `r equire' .. .. C:/Programs2/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `r equire' script/server:3 Rendering C:/Programs2/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_c ontroller/templates/rescues/layout.erb (internal_server_error) == ERROR 1 = == ERROR 2 = C:/Programs2/Rubygem install sqlite3-ruby Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension. C:/Programs2/Ruby/bin/ruby.exe extconf.rb install sqlite3-ruby checking for fdatasync() in rt.lib... no checking for sqlite3.h... no nmake 'nmake' is not recognized as an internal or external command, operable program or batch file. Gem files will remain installed in C:/Programs2/Ruby/lib/ruby/gems/1.8/gems/sqli te3-ruby-1.2.4 for inspection. Results logged to C:/Programs2/Ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ex t/sqlite3_api/gem_make.out == ERROR 2 = -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Unable to install sqlite3
This is a known problem. Hope the link below helps: http://domhackers.blogspot.com/2008/09/sqlite3-ruby-gem-on-windows.html Cheers, Mohit. 11/3/2008 | 2:04 PM. Hammer Ting wrote: I am new to Ruby. Try out a web application, but when I tried to access the page, it has the following error (see ERROR 1 below). So I thought I may have not installed sqlite3 and tried downloading sqlite_3-6-4.zip and sqlitedll_3-6-4.zip, unzipped it and place it in ruby's bin directory. Then I run the command: gem install sqlite3-ruby But found myself encounter the another error shown below (see ERROR 2). Any help would by wonderful == ERROR 1 = MissingSourceFile (no such file to load -- sqlite3): C:/Programs2/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `g em_original_require' C:/Programs2/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `r equire' .. .. C:/Programs2/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `r equire' script/server:3 Rendering C:/Programs2/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_c ontroller/templates/rescues/layout.erb (internal_server_error) == ERROR 1 = == ERROR 2 = C:/Programs2/Rubygem install sqlite3-ruby Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension. C:/Programs2/Ruby/bin/ruby.exe extconf.rb install sqlite3-ruby checking for fdatasync() in rt.lib... no checking for sqlite3.h... no nmake 'nmake' is not recognized as an internal or external command, operable program or batch file. Gem files will remain installed in C:/Programs2/Ruby/lib/ruby/gems/1.8/gems/sqli te3-ruby-1.2.4 for inspection. Results logged to C:/Programs2/Ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ex t/sqlite3_api/gem_make.out == ERROR 2 = --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Reading value from .yml file in controller
On Nov 3, 5:45 pm, mrbless [EMAIL PROTECTED] wrote: Assuming that your yaml file is in test/fixtures directory. Do something like this #say ticket is an object going to be created yml=File.open(#{RAILS_ROOT}/test/fixture/get_value.yml){|ym| YAML::load(ym) } ticket.service_desk_status_id=yml[sd] [service_desk_status_id].to_i #assuming it to be integer ticket.service_desk_category_id=yml[sd] [service_desk_category_id].to_i ticket.service_desk_sub_category_id=yml[sd] [service_desk_sub_category_id].to_i I was going to take a different tack. Assuming this isn't a test fixture but just a file that is being used from somewhere to set default values for new objects, then you could do: default_values=YAML.load_file('path/to/get_value.yml') There are probably other ways to set defaults rather than loading up a file like this though. You could embed them in a class method in the model and just pull them out when you need them. Or maybe apply them in a callback (http:// api.rubyonrails.org/classes/ActiveRecord/Callbacks.html) like before_create. Or use :default in your migration when defining the table - might not be appropriate doing this with id's though. Callback example: class Foo ActiveRecord::Base before_create :apply_defaults private def apply_defaults self.field1='val1' if self.field1.blank? end end -- Daniel Bush --~--~-~--~~~---~--~~ 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@googlegroups.com 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 -~--~~~~--~~--~--~---
[Rails] Re: Reading value from .yml file in controller
Hi Thanks for the reply.May I ask one more question? As Daniel Bush said this isn't a test fixture but just a file that is being used to set default values..So my question normally in which directory I can store this yml file whether inside models or view or anywhere? Sijo -- 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@googlegroups.com 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 -~--~~~~--~~--~--~---