hi i am developing my first app with ror and i have experience and problem which i could not solve so far ... i need a hand please ;) following scenario... - i have a file config/project.rb (my application specifc configurations) with a module "Project" which holds a constant EMAIL_PATTERN (with a regex pattern for email validation) - i load this file in the environment.rb with require_dependency "project" - i have a user model which includes validates_format_of :email, :with => PROJECT::EMAIL_PATTERN the problem now: i have a view for the user which is fine on the first load .. but when i submit the form within the view (postback) then i got the error uninitialized constant User::Project i dont understand this because i have several unit test which test the functionality of validating and there the pattern is applied fine. it has only a problem after postback.. any ideas? -- 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 -~----------~----~----~----~------~----~------~--~---
I''m not sure why you decided to use require_dependency you might be better off using require File.join(File.dirname(__FILE__), ''project'') Also: validates_format_of :email, :with => PROJECT::EMAIL_PATTERN should be: validates_format_of :email, :with => Project::EMAIL_PATTERN to match the case of the module name. HTH, Nicholas On Nov 18, 5:11 am, Michal Gabrukiewicz <rails-mailing-l...@andreas- s.net> wrote:> hi i am developing my first app with ror and i have experience and > problem which i could not solve so far ... i need a hand please ;) > > following scenario... > > - i have a file config/project.rb (my application specifc > configurations) with a module "Project" which holds a constant > EMAIL_PATTERN (with a regex pattern for email validation) > - i load this file in the environment.rb with require_dependency > "project" > - i have a user model which includes > validates_format_of :email, :with => PROJECT::EMAIL_PATTERN > > the problem now: > i have a view for the user which is fine on the first load .. but when i > submit the form within the view (postback) then i got the error > > uninitialized constant User::Project > > i dont understand this because i have several unit test which test the > functionality of validating and there the pattern is applied fine. it > has only a problem after postback.. > any ideas? > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
thanks nicholas... the problem was the require_dependency .. when i use the common require then it works fine ... i used require_dependency because i want the files be reloaded everytime i change something .. i dont understand why it does not work with it. btw: the upper cased project was a typo her in the post -- 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 -~----------~----~----~----~------~----~------~--~---