search for: unprocessable_entity

Displaying 20 results from an estimated 67 matches for "unprocessable_entity".

2008 May 10
0
can javascript handle 422 response
...flash[:notice] = ''Response was successfully updated.'' format.html { redirect_to(@response) } format.xml { head :ok } format.js { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @response.errors, :status => :unprocessable_entity } format.js { head :unprocessable_entity } end end some_view.html.erb: ............................................................ <%= check_box_tag ''response[status]'', "1" , response.status == "done", :onclick => toggle_value(response) %> <%=...
2010 Sep 04
3
its easy but i forgot all
...ice => ''Loan was successfully created.'') } format.xml { render :xml => @loan, :status => :created, :location => @loan } else format.html { render :action => "new" } format.xml { render :xml => @loan.errors, :status => :unprocessable_entity } end end end in my views i am passing value like this <%= link_to ''New Loan'', :controller => ''loans'', :action => ''new'', :borrower_id => @borrower.id %> every thing working fine in Action new logger.d...
2012 Sep 18
4
"best practices" for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.
...this, it looks easy: def index @companies = Company.all respond_with @companies end But respond_with makes assumptions about what should be called, and then you should handle errors because it should try to return those as JSON with an appropriate HTTP status code (:ok, :unprocessable_entity, :created, :forbidden, :internal_server_error, etc.), then there is location url which I''m not sure if has a place in a service meant for consumption by a service meant to be consumed by a javascript app?, etc. For an idea of the various things that people have to do and what they run...
2012 May 08
1
One to many relationships
...t_to @professor, notice: ''Professor was successfully created.'' } format.json { render json: @professor, status: :created, location: @professor } else format.html { render action: "new" } format.json { render json: @professor.errors, status: :unprocessable_entity } end end end # PUT /professors/1 # PUT /professors/1.json def update @professor = Professor.find(params[:id]) respond_to do |format| if @professor.update_attributes(params[:professor]) format.html { redirect_to @professor, notice: ''Professor was s...
2007 Dec 22
3
collection_select validation problem
...39;' format.html { redirect_to(@program) } format.xml { render :xml => @program, :status => :created, :location => @program } else format.html { render :action => "new" } format.xml { render :xml => @program.errors, :status => :unprocessable_entity } end end end VIIEW <%= collection_select(''program'', ''client_id'', @clients, :id, :name, { :include_blank => true }...
2013 Apr 02
4
gmaps4rails: undefined method `model_name' for NilClass:Class
...ect_to @location, notice: ''Location was successfully created.'' } format.json { render json: @location, status: :created, location: @location } else format.html { render action: "new" } format.json { render json: @location.errors, status: :unprocessable_entity } end end end # PUT /locations/1 # PUT /locations/1.json def update @location = Location.find(params[:id]) @json = Location.all.to_gmaps4rails respond_to do |format| if @location.update_attributes(params[:location]) format.html { redirect_to @location, n...
2008 Sep 10
5
xmlhttprequest for updating
Hello, I am updating an object with an AJAX form: view: <% remote_form_for(@sample, :update => "content2") do %> <p> parameter: <br /> <%= select("sample","parameter",Parameter.find(:all).collect {|p| [p.description.gsub(''_'', '' ''),p.id]},{},{:size => 4, :multiple => true}) %>
2012 Feb 20
1
respond_to format.json not being called
...respond_to do |format| if @m.save format.html {redirect_to root_url, :notice=>"Message sent"} format.json {render :json=>@m, :status=>:created, :location=>@m} else format.html {render :action=>:new} format.json {render :json=>@m.errors, :status=>:unprocessable_entity} end end Obviously, I''m not using link_to_function or anything, so I''m wondering if the request format header isn''t being set properly without using the built-in rails functions? Any help would be appreciated. Many thanks. -- Posted via http://www.ruby-forum.com/....
2011 May 09
0
rails guides - getting started - section 10 security
...ice => ''Post was successfully created.'') } format.xml { render :xml => @post, :status => :created, :location => @post } else format.html { render :action => "new" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end # PUT /posts/1 # PUT /posts/1.xml def update @post = Post.find(params[:id]) respond_to do |format| if @post.update_attributes(params[:post]) format.html { redirect_to(@post, :notice => ''Post was successfully updated.'') }...
2010 Apr 14
1
Rails validations app specific problems
...lash[:notice] = ''Your cart has been updated.'' format.html { redirect_to( current_cart_url ) } format.xml { head :ok } else format.html { redirect_to( current_cart_url ) } format.xml { render :xml => @order.errors, :status => :unprocessable_entity } end end end def cart create_current_order unless current_order @order = current_order end def checkout @order = current_order end def complete_order @order = current_order respond_to do |format| if @order.update_attributes(params[:order])...
2008 Jan 26
0
RSpec and resource_controller plugin
...39;' format.html { redirect_to(@hardway) } format.xml { render :xml => @hardway, :status => :created, :location => @hardway } else format.html { render :action => "new" } format.xml { render :xml => @hardway.errors, :status => :unprocessable_entity } end end end # PUT /hardways/1 # PUT /hardways/1.xml def update @hardway = Hardway.find(params[:id]) respond_to do |format| if @hardway.update_attributes(params[:hardway]) flash[:notice] = ''Hardway was successfully updated.'' forma...
2008 Jul 29
0
handling multiple lookup tables in rails
...format.html { redirect_to(@lookup,:mdl=>@mdl) } format.xml { render :xml => @lookup, :status => :created, :location => @lookup } else format.html { render :action => "new" } format.xml { render :xml => @lookup.errors, :status => :unprocessable_entity } end end end # PUT /lookup/1 # PUT /lookup/1.xml def update @lookup = @theModel.find(params[:id]) respond_to do |format| if @lookup.update_attributes(params[:lookup]) flash[:notice] = ''Lookup was successfully updated.'' format.html...
2008 Dec 11
1
help needed regaring Acts As Taggable On Steroids
...y created.'' format.html { redirect_to(@book) } format.xml { render :xml => @book, :status => :created, :location => @book } else format.html { render :action => "new" } format.xml { render :xml => @book.errors, :status => :unprocessable_entity } end end end def tag_cloud @tags = Books.tag_counts end In the new.html.erb I have added these lines : <% tag_cloud @tags, %w(css1 css2 css3 css4) do |tag, css_class| %> <%= link_to tag.name, { :action => :tag, :id => tag.name }, :class => css_class %&...
2009 Mar 15
1
remote_form_for ajax validation
...notice] = ''OK!'' format.html { redirect_to(@product) } format.js else flash.now[:notice] = ''Error!!'' format.html { render :action => "show" } format.xml { render :xml => @product.errors, :status => :unprocessable_entity } format.js end end end The model: class Product < ActiveRecord::Base validates_presence_of :title end And the RJS template: page.replace_html :description, :partial => "product", :object => @product page.replace_html :notice, flash[:notice] page.visual_...
2010 Jun 23
0
Rails 3 - AJAX Response
...ice => ''User was successfully created.'') } format.xml { render :xml => @user, :status => :created, :location => @user } else format.html { render :action => "new" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end # PUT /users/1 # PUT /users/1.xml def update @user = User.find(params[:id]) unless params[:user][:type_id] @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) format.html {...
2012 Sep 17
1
require current_password to update user information
...format.html { redirect_to users_url, notice: "User #{@user.name} was successfully updated." } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end here''s my form view <% if params[:action] == "edit" %> <div class="field"> <%= f.label :password %><br /> <%= f.password_field :current_password, :placeholder =>...
2012 Sep 22
1
formtastic does not save at all
...format.html { redirect_to @give, notice: ''Give was successfully created.'' } format.json { render json: @give, status: :created, location: @give } else format.html { render action: "new" } format.json { render json: @give.errors, status: :unprocessable_entity } end end end If there is at least an error, I may be able to provide more information, but the submit action does not do anything, so I am stuck here. Can anyone guess where the problem is? soichi -- Posted via http://www.ruby-forum.com/. -- You received this message because you...
2011 Mar 17
7
Beta Invitation in Rails 3, little problem
...ated.'') } format.xml { render :xml => @invitation, :status => :created, :location => @invitation } redirect_to root_url else format.html { render :action => "new" } format.xml { render :xml => @invitation.errors, :status => :unprocessable_entity } end end end I BELIEVE IS A LITTLE PROBLEM BUT I DON''T UNDERSTAND WHERE IS MY MISTAKE Thanks for read my post bye, C -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" g...
2010 Jan 25
9
skinny Controllers, fat models with REST?
...'' format.html { redirect_to(@task) } format.xml { render :xml => @task, :status => :created, :location => @task } else format.html { render :action => "new" } format.xml { render :xml => @task.errors, :status => :unprocessable_entity } end end else respond_to do |format| #BENUTZER HAT KEINE RECHTE subtask anzulegen format.html { render :file => "#{Rails.public_path}/ 401.html", :status => :unauthorized } #401 page laden format.xml { render :xml => @task.errors, :status...
2009 Feb 09
3
rendering original view
...nder :xml => @review, :status => :created, :location => @review } else # format.html { render :action => "new" } format.html { render :action => "new" } # <----- HERE format.xml { render :xml => @review.errors, :status => :unprocessable_entity } end end end In this view the line format.html { render :action => "new" } renders the reviews new method when the validation fails...thing is I want to show the school and the error messages, (schools controller show method) like this line, format.html { redi...