search for: save_with_validation

Displaying 10 results from an estimated 10 matches for "save_with_validation".

2008 May 25
2
record will absolutely not save! so weird, please help.
...at: nil, invoice_id: nil, creator: nil, check_number: nil, payable_type: "Student", payable_id: 608> >> p.valid? => false >> p.school_id = 1 # school_id is attr_protected => 1 >> p.valid? => true >> p.save => nil >> p.save! => nil >> p.save_with_validation => true Why is save returning nil? Why is save_with_validation working? I have a Tuition model that is very similar to the Payment model and it does not have this problem. Please help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to...
2006 Jun 13
7
model validation across multiple views
I have a rather complex object with a number of attributes. For a variety of reasons, I would like one view to create the object with only a couple of fields completed, then a second and third view to finish all the fields. I would like the model to validate_presence_of all these fields, since eventually I need them all there, and I would like each page to validate its portion of the fields that
2006 Jul 25
1
save trouble with has_many belongs_to relationship
I have a bit of code in a controller that looks like this: @current_festival.monitor_preferences.each do |pref| if pref.user_id == @me.id pref.preference = params[:monitor_pref] #pref.save end end @current_festival.save_with_validation(false) the Festival class has_many :monitor_preferences the MonitorPreference class belongs_to :festival In the configuration above, the monitor_preference is not saved with the new value from the params[:monitor_pref]. However, if I uncomment pref.save, then it is saved. Why doesn''t...
2008 Apr 25
0
Spec migrations?
..., Harm PS the actual spec: describe Member, "should migrate properly" do it "should migrate correctly from a column manager to a role manager" do `rake db:drop` `rake db:create` `rake db:migrate VERSION=59` m1 = Member.new(:manager => true) m1.save_with_validation(false) m2 = Member.new(:manager => true) m2.save_with_validation(false) m3 = Member.new(:manager => true) m3.save_with_validation(false) `rake db:migrate VERSION=60` Member.find(m1.id).has_role?("manager").should be_true Member.find(m2.id).has_role...
2006 May 11
2
Login Generator and Salter
okay, I''m using login generator. And when I log in alwase get failed. So I looked at my log, I gatherd infomation that says on creation the salted pass was: 2b8b06e5a650a4b97f146e6b5ae7ab82c43707e on login the salted pass is: 2b8b06e5a650a4b97f146e6b5ae7ab82c43707e and in my DB it is: 2054d52ca901ff70b5a334cb3e13d8c67940c3f3 So in my DB it change why? -- Posted via
2006 May 12
1
Some error about adding.
..."xw","w","m","l","xl","s","ss"] if @user.send(this_type) >= 3 @this_type = @ranks.index(this_type) @nexts_number = @this_type.to_i + 1 @next_type = @ranks[@nexts_number] @user.send(@next_type) += 1 @user.send(type) @user.save_with_validation(false) flash[:notice] = "Exchange complete." else flash[:notice] = "Exchange not met." end redirect_to :action => "upgrade" end Here is usage: <%= link_to ''exhcange strong for super strong'', :action => "exch_link", :type => &...
2006 Jan 19
2
Easy way to handle form input without a model class?
I have a couple forms that I''d like to be able to validate and automatically populate, but it shouldn''t be based on AR. In fact I often have a bunch of small forms that I can''t really justify writing a whole new model class for anyway. I''d like to validate the form input, and then use rails helpers to automatically populate the form if validations fail.
2006 Jun 15
0
Re: rails question
...val model validates_presence_of :name ) def create_festival @festival = Festival.new if request.post? @festival.attributes = params[:festival] # sending in only the name at this point... if !(@festival.errors.invalid? :name ) # => true if name is invalid @festival.save_with_validation(false) @flash[:success] = "You have created a festival." redirect_to :action => "admin_accounts_menu" and return end end end but that just seems to go ahead and save a festival with an empty name... I''d appreciate your help. Regards, S...
2006 May 23
2
Overriding validation?
Is there a "normal" way to override the behavior of validator methods (like validates_presence_of) for updates vs. creation? For example, in the AWDR example store program, the User class validates the presence of the password and its length - which makes sense when the user entry is created. But what if you wanted to provide an update form that updates just certain items
2005 Dec 26
3
Override Validation?
Hi all, is there a way to override the validation methods so as to avoid the div.fieldWithErrors divs from being created on the redisplayed form? Many thanks in advance, Nicky