similar to: Validation question

Displaying 20 results from an estimated 500 matches similar to: "Validation question"

2005 May 11
7
1.0.8 Salted hash login generator available
All, Version 1.0.8 of the salted hash login generator is available. This contains a few minor bug fixes with the generator plus some README clarifications. If you are successfully running with the code already, you probably do not need this. Joe
2007 Oct 01
3
stringify_keys!
I have seen this numerious times and still have no idea what it means: undefined method `stringify_keys!'' for "blah22":String I am tring to change a password. My code looks like: def change_password @user = User.find_by_emailaddr( params[:email] ) if @user.nil? # user profile not created flash[:notice] = "<b style = \"color:red\">No such
2006 Oct 19
1
Question about variable assignments/scoping after render call
I''ve got a question about how variables are made available to templates. We have a test that looks something like this: def test_variable_assigned xhr :get, :do_stuff, :id => 1 assert_not_nil assigns(:thing) end And our app code looks like this: class SuperClass < ActionController def do_stuff @parent_model = ParentModel.find(params[:id]) render :template
2006 Jun 08
3
Macros and stuff
I was looking at my controller code and the edit/create/update/new for each are practically identical. So first I DRY''d the four methods in each controller to just one and then I decided to write a single macro for all my controllers. This is the macro: def self.edit_action_for(model, options = {}) model_class = Object.const_get(model) define_method(:edit) do
2006 Apr 07
6
validation nightmare
Please help, I am really at a loss at how validation is supposed to work in rails. Model contains acts_as_tree I want to force my NEW objects to have a parent I do NOT want existing object to have a parent so I only want to have parent_id on create, NOT on update. I am trying this: def validate_on_create validates_presence_of :parent_id, :message => "You must specify a
2011 Apr 28
3
difference between validate and validate_on_create
i just ran into a problem with some test, and i am not exactly sure why, but the difference happened when i changed my model validation from: validate :custom_validation to: validate_on_create :custom_validation can someone give me any ideas on where in the chain the validation takes place? thanks! -- Posted via http://www.ruby-forum.com/.
2006 May 19
1
pass text_field to controller when using periodically_call_r
Hi. Can anyone help with this? In a view, I have a text_field_tag( :mytextfield ). I would like to pass the current value of that text_field_tag to a periodically_call_remote - something like periodically_call_remote( :url => { :action => :do_it, :thetextval => :mytextfield.value } ) - Any idea how can I pass and/or access the value of the text_field_tag in my do_it controller?
2008 Jun 15
11
[PATCH] helper to create fb css stylized table
I attached a rails helper implementation of the fb_table described here: http://wiki.developers.facebook.com/index.php/Facebook_Styles I included testing and comments. I hope you find it useful. Curiously, it''s really a small extension of FBML. Richard -------------- next part -------------- Index: test/rails_integration_test.rb
2006 Apr 07
6
Multiple view types for a single action?
Is it possible to have more than one kind of view for a specific action, for example an .rhtml and a .rjs file to handle the view for the same action? I suspect not, but this makes me wonder if there a way to call the .rjs file from within the .rhtml so the statements within it get executed? Thanks, Andy
2006 Apr 10
3
form_remote_tag : additional onsubmit funct. possible ?
Is there a way to add onsubmit functionality to a form_remote_tag with an additional javascript directive? eg I''d like for an inline javascript to make the form''s div container hidden as soon as the button is pressed to avoid having it possibly get pressed again ( sometimes the rails response is slow enough for a user to think they need to re-press it ). example: <div
2006 Jan 13
1
validating without saving
i am trying to validate without saving use the valid? method on my object. however i keep getting the following error (that i reproduced in console) "NoMethodError for field" Any ideas ? thanks adam Loading development environment. >> p = Post.new => #<Post:0x407b6050 @attributes={"created_on"=>nil, "subcat"=>1, "cat"=>nil,
2006 Jun 05
5
Controller-wide instance variable
Is it possible to declare an instance variable in a controller that is available to every action without defining the variable in every action? -- Posted via http://www.ruby-forum.com/.
2007 Oct 25
3
Setting session values
Okay, I give up. I have been trying to set session values in a controller, but no matter what, once the request is made and inside the controller, the session is empty. What''s the correct way? I have tried session[''whatever''] = something controller.stub!(:session).and_return(session) I tried creating a new session, but nothing seems to do it. I''m sure
2005 Feb 09
1
[DEFECT] ''validates_inclusion_of'' not working as expected (couldn''t post to Trac as it gave me an error)
Hello, I tried to post this as a bug on the trac site, but whenever I hit submit, I got the error message: --- Precondition Failed The precondition on the request for the URL /newticket evaluated to false. --- Anyway... Let''s say I have the following model classes: --- class Project < ActiveRecord::Base has_many :tasks end class Task < ActiveRecord::Base belongs_to
2008 Nov 19
2
Where should I put "prerequisite logic"?
Hi there, I have this model called InventoryItem. Every time an InventoryItem is created (through the CharactersController and the create_item action) I need to update others tables and make lookups in other tables, to check if the Character has the prerequisites to actually create the InventoryItem. My problem is that I cannot seem to find a good place to put this logic. I''ve tried to
2006 Jun 28
1
Where is this documented?
If I create a controller, and put only one line in it def do_it render :text => "Hello" end in it, then rails doesn''t display the view do_it.rhtml. I''m looking for the general rule behind this behavior (including any details that I may not be aware of). Where is such behavior documented?
2006 Aug 09
1
Migrating a Field to External Model
I have a model Product with an attribute ''brand''. Currently it is a simple attribute, however, I am migrating it to a separate model Brand so that I can have other attributes with each brand. I created the the model and created and ran the migration to create the new table. So far so good. Then I created a separate migration to transfer the data. The up method
2006 Aug 01
2
Partial Naming Madness
Hi, I am having the following issue with a partial. During initial page load, I am doing a "render_partial_collect ''foo'', @foos", and all goes well. Each foo partial makes use of a variable inside called ''foo'' (and can get foo.id etc). After all the partials are loaded, I need to :update a div corresponding to one of the partials (ie re-load the
2006 May 09
3
validations erasing the form
Hi there I have a for with a couple of text_fields. I''m doing some validation via the model and when the validation "works" I get there was an error on blah blah the problem is the form is erased and I have to fill up the form again! I saw that scaffold keeps the form filled when the validation "works" but I dont know exactly what''s making it happen! I would
2006 May 04
2
validates :on 2
Hello, I need to have this for :create and :login how do I do so validates_presence_of :login, :password, :password_confirmation, :user_name, :email, :on => :create I do need it to be off in a number of places though -- Posted via http://www.ruby-forum.com/.