similar to: RESTful RESOURCE PARTIAL UPDATE

Displaying 20 results from an estimated 200 matches similar to: "RESTful RESOURCE PARTIAL UPDATE"

2007 May 03
2
Multiple Update Actions that are Relatively the same
Hi there, I have 2 actions that are rather identical: # Put /account/you/update_password def update_password @user = current :user respond_to do |format| if @user.update_attributes(params[:user]) format.html {redirect_to account_url} else format.html {render :action => "edit_password"} end end end # PUT /account/you # Update
2006 Jan 13
2
Change Password with acts_as_authenticated
I want to have a form to change a users password. I can''t figure out what the method in the controller should look like. I tried @user.save and @user.update_attributes, but can''t get it to work. My Form: ############################## <%= start_form_tag :action => "update_password", :id => @user.id %> <%= password_field ("user",
2007 Oct 29
2
error message after upgrading to Gusty Gibbon Ubuntu
I have started to get the error message "wrong number of arguments (1 for 0)" since I upgraded to Gusty Gibbon. I am new to ROR so I have no clue. This is the code that was running def create @user = User.new(params[:user]) if @user.save flash[:notice] = ''User was successfully created.'' redirect_to :action => ''list'' else
2007 Oct 24
8
validates_confirmation_of not working
Hello to everyone, Well, very frustrated with this one because I am following the example straight from the documentation and it is not working. First when I try: validates_confirmation_of :password, :on => :password_update (password_update is a def in my User model which works fine without this validation in please) I get the following error: TypeError in UsersController#update_password
2008 Aug 26
5
undefined method
I''m trying to pass a method to another object/method as a variable. Example one, login 1 works just fine. def login1 @driver.Login(username, password) end However, if I try to pass "Login" to the driver as an argument (example two Login 2), I get "undefined method `command_string'' for #<SOAP::RPC::Driver:0x316dc28>" "Login" is a legit
2006 Apr 14
1
Validating Existing Models
I''ve got a user object which has quite a few attributes mapped to the database. As of right now I''ve got some validations in the model like: validates_presence_of :password, :message => "You must specify a valid password." validates_confirmation_of :password, :message => "Password doesn''t match the confirmation." validates_presence_of
2006 Mar 13
3
validates_associated problem
Hello, I have a situation where an ''employee'' belongs to a ''department'' and have setup the relationship as follows. class Employee < ActiveRecord::Base belongs_to :department, :foregin_key => "department_id" validates_associated :department_id end class Department < ActiveRecord::Base has_many :employees def validate_on_update
2014 Mar 25
0
Looking for some glue between Strong Parameters and CanCan
Hello Rails World, does anybody know a good solution for Strong Parameters in a Rails app authorized by Cancan (or a similar authorization gem)? def user_params if current_user.admin? params.require(:user).permit! else params.require(:user).permit(:password, :password_confirmation) end end Now I want to do this the "Cancan way". My first idea looks strange to me: def
2015 Nov 22
0
nouveau: BUG: KASAN: slab-out-of-bounds in memcpy+0x1d/0x40
Hello, I'm seeing this kasan report after booting with linus v4.4-rc1-290-g3ad5d7e. BUG: KASAN: slab-out-of-bounds in memcpy+0x1d/0x40 at addr ffff880169e21fd0 Read of size 64 by task kworker/1:0/14 ============================================================================= BUG kmalloc-8192 (Not tainted): kasan: bad access detected
2006 Dec 07
2
validate_on_destroy ?
What''s the best way to validate_on_destroy. Rails only seems to include validate_on_create and validate_on_update methods. I don''t want to resort to doing: before_destroy do |j| raise "There is an error" if j.etc end Is there a way of finding out what action (create/update/destroy) is being performed if I use the ''validate'' method? -- Posted via
2008 Dec 05
4
Replicating Form Behaviour in Functional Test
Hi, I''m really struggling getting a controller test to pass while the form that uses the method operates correctly. I would really welcome a second pair of eyes to help me find out what I''m missing. The test def test_set_password @request.session[:user] = users(:admin) put :set_password, :id => users(:one).id, :user => {:password => "newpass",
2006 Feb 03
2
validation only on a specific action
Hello again! I have a action that lists users and that allows an admin user to create new users. When the admin user creates a new user an e-mail is sent to the created user telling him to register in the site. I want to validate the user name and password only when the user register and not when the admin user creates it. Can anyone tell me how to do this? Thanks. Best regards, Hugo --
2005 Sep 27
2
No Custom Validation
Hi, Correct me if I am wrong but there doesn''t seem to be an easy way to add validation outside the pre-built ones (validates_presence_of, validates_lenght_of, etc.). Ideally there should be something like: Class Person < ActiveRecord::Base validates :my_method, :on => create, :message => ''was not valid'' def my_method(param) false unless
2006 Mar 06
4
One-way change
I''m developing an app, and I want to make a single boolean field OK to change from 0 to 1, but not allow 1 to 0. Seems like the model''s validate method would be the right place for this, but I''m not sure how to implement it. Any suggestions (actual or pointers to) are greatly appreciated. -- Posted via http://www.ruby-forum.com/.
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 19
2
call validate functions
Hi on the code below the validates all the form fields if @client.save flash[:notice] = ''Client was successfully created.'' redirect_to :action => ''list'' else render :action => ''new'' end how can I do this action without having to save the object? ie if validate #move on to next stage else redner
2006 Mar 02
3
validates_uniqeness_of
Hello, I am trying to understand usage of validates_uniqeness_of. Say I have, two column ''name'' and ''email'' in my table users three unique key is possible for these two columns 1. name 2. email 3. name and email together My question is, if I write validates_uniqueness_of :name, :email what uniqueness is it going to apply, 1 and 2 or, 3 ? Thanks, Mohammad
2006 Feb 28
1
Validate two fields so they do not match
Hey all, I have two form fields (select dropdowns) that are ''startlocation'' and ''endlocation''. These two cannot be equal to each other on save and I am wondering how to put validation into the model for this. Is is possible to do it in the model, or do I need to do this in the controller? Thanks in advance! Ryan -- Ryan Prins rprins@gmail.com
2007 Aug 02
1
write_attribute functionality for related objects?
Hi. Given: class Group < AR has_many :users end Is it in any way possible to retain reference to the old users when they get replaced using group.users=(new_users) ? The below doesn''t work but illustrates what I''m looking for: class Group < AR has_many :users def users=(new_users) @old_users = users write_attribute(''users'', new_users)
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/.