| tiglionabbit | if your model validates for a lot of things just as a safety, that couldn't really go wrong from the forms provided to your users.. how do you decide which errors are worth showing your users as their own fault and which ones they should contact you about because the system is broken? |
| lisa | tiglionabbit: that's up to you tiglionabbit: in your controller, for example, you could handle the fatal errors |
| tiglionabbit | what errors aren't fatal? |
| lisa | "Error: Success" ? ;) |
| tiglionabbit | that's not a fatal error I mean that's not an error |
| lisa | fatal as in "OMG EVERYBODY PANIC!!!! THE SYSTEM IS GOING DOWN!" versus "hey user you didn't type the right thing there" |
| tiglionabbit | what I mean is, say you have a form with one field in it. Your user could only possibly mess up this one field. But it ends up altering some big model, which has all sorts of validations in it oh yeah, you can specifically look for errors_on some thing is it a good idea to set up validators that the user couldn't possibly get wrong, just to test your own code? |
| nubyonline | hi |
| tiglionabbit | is it okay to use validates_associated on a polymorphic join type? |
| HappyCodr | so vompls had the wrong variable name in his view. His text field was set to cus[group_name] and in his controller he was looking for params[:group_name]. He should have been looking for params[:cus][:group_name] |
| xcess | Hi, by default rails automatically prepend the name of the filed with message when any error occurs. How can I avoid this to display totally customized messages? |
| |PiP| | lets say i have a customer's model. how do i get the list of distinct countries that my customer's belong to? is there a way without using SQL? |
| ReinH | |PiP|: customer belongs_to :country ? |
| |PiP| | ReinH: yes. but i want to find all the DISTINCT countries |
| ReinH | you want all the countries that all your customers belong to, but without duplicates ok |
| |PiP| | exactly |
| ReinH | so Customer.find(:all).map(&:countries).flatten.uniq flatten may not be needed |
| |PiP| | i see. |
| ReinH | find all customers, map (collect) their countries, uniquify |
| |PiP| | how would i find the list of all customers that lived in a particular country? |
| ReinH | country.customers read up on ActiveRecord::Base here: Check the rails API! http://labs.parkerfox.co.uk/ruby.search |
| |PiP| | ReinH: no you are right i knew that |
| ReinH | The api really does tell you this stuff |
| |PiP| | ReinH: I actually have a more complicated problem |
| ReinH | kk |
| |PiP| | ReinH: that I am trying to solve, and I am trying to piece together a solution by asking more simplified questions |
| ReinH | what's the complicated problem? I'm in a good mood |
| |PiP| | Well, it may not seem complicated to you, but here goes |
| carterparks | ya, don't pussy foot around, |PiP| , we can handle complicated problems |
| dionysian | heh |