similar to: validating embedded form parameters

Displaying 20 results from an estimated 30000 matches similar to: "validating embedded form parameters"

2012 Jan 19
4
redirect_to with a hash instead of parameters
All, I have numerous places in my codebase like this: redirect_to :action => ''schedule_by_uid_and_run_date'', :uid => @schedule.first.train_uid, :year => @date.year, :month => @date.month, :day => @date.day I''d like to replace the :year, :month and :day parameters with a hash containing the three parameters. @date is an instance of a Date class,
2006 May 18
6
Form actions with additional parameters
Hiall, I want to give the action of a form an additional parameters but can''t figure out how to do it. My code looks like this <%= start_form_tag :action => ''create'', next_step => true %> <%= render :partial => ''user_form'' %> <%= render :partial => ''community_form'' %> <%= submit_tag
2005 Oct 12
4
Validating 2 related models at once not working
Hello, I have a form that submits data to two related models/tables. One is Customer the other is Address. Validation for Customer works fine but not for the Address. Class Customer < ActiveRecord::Base has_one :address validates_presence_of :login, :password, :email validates_associated :address end Class Address < ActiveRecord::Base belongs_to :customer validates_presence_of
2006 Mar 30
4
redirect_to("url") with post?
Is there a Rails-friendly way to redirect_to an url and post some parameters with that? I''ve tried: redirect_to("http://whatever.com", { ''postme'' => ''this'' }) redirect_to("http://whatever.com", :post => { ''postme'' => ''this'' }) redirect_to("http://whatever.com", :options
2006 Dec 30
1
redirect_to(:action => ''foo'') and return
I''m not sure why this is happening, but if I do this in a controller unless @variation && @variation.quantity > 0 flash[:error] = "Sorry, that product is currently not available." redirect_to(:action => ''error'') and return end rspec tells me 2) ActionController::DoubleRenderError in ''The Carts controller with an
2008 Dec 03
2
Render and/or redirect were called multiple times in this action
I''m trying to add an application enabled/disabled flag in my application.. This is my code. [code=] # application.rb ... before_filter :check_enabled_flag private def check_enabled_flag application_flag = ApplicationFlag.find(:first) if application_flag.application_enabled redirect_to application_disabled_path and return end end[/code] and for some reason
2007 Jul 25
5
editing multiple models in one form
Very new to this but would appreciate a hand as this is driving me mad, I''m trying to update both degree and assigned from a single form, the degree section updates fine but assigned just retains the same values, any help much appreciated! my edit.rhtml file looks like: <h1>Editing degree</h1> <%= error_messages_for :degree %> <%= start_form_tag :action =>
2010 Mar 21
3
Error in the code Doube Render (colins')
Hi everyone, i followed colins example and it worked perfectly but now i get this error ActionController::DoubleRenderError in UserController#login Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to
2006 Feb 17
1
validate() with has_many association
I''m creating a simple portfolio site for a painter. I have a painting and an image model with following relationship: Painting has_many :images Image belongs_to :painting On the edit screen the user can edit the Painting data as well as upload pictures for a thumbnails and full size image. The Image model extracts filename, width, and height from the uploaded file, saves those
2007 Aug 15
4
nuby: how spec redirect_to at ApplicationController
Good morning rspec people! Still rspec nuby: I must do something wrong obviously. How can I spec about redirect_to at ApplicationController describe ApplicationController do it "method login_required should redirect to home path without login" do pending "I tried to use controller.login_required.should be_redirected and got NoMethodError with nil object
2010 Jul 29
1
Testing controller and action with parameters
I have an action and I am testing it like this: The action: ========== def create @event = Evento.new(params[:event]) @event.aproved = false if @event.save redirect_to :action => "index" else render :action => "new" end end The RSpec test: ============== before do @event = mock_model(Event)
2006 Aug 08
1
form parameter
How can I change some parameters in a function of the controller. I have a User_Controller, who''s responsible for update the information fields in the database. The parameters are "id", "firstname" and "lastname". Now, I want to manipulate parameter "lastname", because I would like to add at the end a point. >> Thomas Miller
2006 Aug 07
2
Ugggh..another recipes question
sorry, because it seems that I need more explanation on this Rails Recipes authorization - I finally got the code working but after using the login I get this back from Rails- Routing Error No url can be generated for the hash {} I''m guessing it''s coming from the redirect- def login if request.post? session[:user] = User.authenticate(params[:first_name],
2008 Jan 23
4
redirect_to broken?
Is ActionController''s redirect_to method broken by Facebooker? When I try to invoke it and execute through apps.facebook.com, I get a blank page returned, response code 200, no redirect. When I try to connect directly to the server (not through apps.fb), I get the infinite recursion error described minutes ago. Are any of you able to use redirect_to successfully, and if so, any ideas
2006 Jul 18
6
before_filter chains and halting at an arbitrary filter
Hi--I''m trying to implement a 2-level authentication system, where I have one before_filter which does general user authentication, and another which does further authorization for a specific controller. I have it set up as follows: before_filter :authorize_level_2 prepend_before_filter :authorize_level_1 which causes authorize_level_1() to run, and then authorize_level_2().
2007 Oct 26
15
Adding see_other method to ActionController
303 (See Other) is the status code a resource returns to tell the client about the new resource it just created (typically after a POST). 301/302 is the status code some servers return to tell the browser where to go next. It works because browsers ignore the distinction and treat all three status codes the same way, and few people understand the difference. But when developing an application
2007 May 21
4
Spec''ing redirect with arbitrary parameters
I''ve got the following expectation: response.should redirect_to(:action => "new", :video_id => "1", :process_id => "2", :origin_id => "3") that fails with this error message: expected redirect to {:video_id=>"1", :process_id=>"2", :origin_id=>"3", :action=>"new"}, got redirect to
2009 Jan 28
4
format.html and redirect_to
I was wondering what the purpose of wrapping a redirect_to in a format.html block is. I get why you''d want to do this with a render, but if you''re redirecting the browser to another URL, what''s the point? As I understand it, when redirect_to is called, Rails sends a 302 back to the browser, so I''m having trouble understanding why format plays any part in this.
2006 Feb 27
3
form questions
I have a very simple form that looks allows an input for an error code and then give the show page from the scaffolding if the error code is in the database and a notification on the list page, again from the scaffolding if not. Here''s the form: find.rhtml <h1>Find error</h1> <%= start_form_tag :action => ''search''%> <p><label
2005 Dec 31
2
Validation errors not displaying and will not save
Hello all, I''m fairly new to rails so I''m probably doing something really stupid here.... I have been banging my head at this for hrs now... I''ve tried so many different things and nothing seems to get me any further... I am trying to create an image uploading page that will simultaneously create thumbnails to separate file directories and update the database via