#rubyonrails - Thu 1 Mar 2007 between 02:01 and 02:36



tiglionabbitif 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?
lisatiglionabbit: that's up to you
tiglionabbit: in your controller, for example, you could handle the fatal errors
tiglionabbitwhat errors aren't fatal?
lisa"Error: Success" ? ;)
tiglionabbitthat's not a fatal error
I mean that's not an error
lisafatal as in "OMG EVERYBODY PANIC!!!! THE SYSTEM IS GOING DOWN!" versus "hey user you didn't type the right thing there"
tiglionabbitwhat 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?
nubyonlinehi
tiglionabbitis it okay to use validates_associated on a polymorphic join type?
HappyCodrso 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]
xcessHi, 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
ReinHyou want all the countries that all your customers belong to, but without duplicates
ok
|PiP|exactly
ReinHso Customer.find(:all).map(&:countries).flatten.uniq
flatten may not be needed
|PiP|i see.
ReinHfind all customers, map (collect) their countries, uniquify
|PiP|how would i find the list of all customers that lived in a particular country?
ReinHcountry.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
ReinHThe api really does tell you this stuff
|PiP|ReinH: I actually have a more complicated problem
ReinHkk
|PiP|ReinH: that I am trying to solve, and I am trying to piece together a solution by asking more simplified questions
ReinHwhat's the complicated problem?
I'm in a good mood
|PiP|Well, it may not seem complicated to you, but here goes
carterparksya, don't pussy foot around, |PiP| , we can handle complicated problems
dionysianheh

Page: 2 9 16 23 30 37 44 51 58 65 72 79 86 93 100 107 114 121 128 

IrcArchive