19

Вопрос по ajax, ruby-on-rails, jquery – Форма AJAX (с использованием simple_form) с сохраненной проверкой ошибок

Error: User Rate Limit Exceeded

Error: User Rate Limit ExceededError: User Rate Limit Exceeded...

Error: User Rate Limit Exceeded

enter image description here

Error: User Rate Limit Exceeded

enter image description here

Error: User Rate Limit Exceeded

  def index

    #This is for the product listing

    @brands = Brand.all.reverse 

    #This is for the form   

    @brand = Brand.new
    @model = Model.new
    @submodel = Submodel.new
    @style = Style.new

    respond_to do |format|
      format.html
    end
  end

Error: User Rate Limit Exceeded

<%= simple_form_for @brand, :html => { :class => 'form-horizontal' }, :remote => true do |m| %>

  <fieldset style = "margin-top:34px;">
    <legend></legend>
    <%= m.input :name, :label => 'Brand' %>         
    <%= m.simple_fields_for :models, @model do |p| %>    
      <%= p.input :name, :label => 'Model' %>
      <%= p.simple_fields_for :submodels, @submodel do |s| %>
        <%= s.input :name, :label => 'Submodel' %>
        <%= s.simple_fields_for :styles, @style do |ss| %>
          <%= ss.input :name, :label => 'Style' %>
        <% end %>
      <% end %>
    <% end %>

    <div class="form-actions">
      <%= m.submit nil, :class => 'btn btn-primary' %>
      <%= link_to 'Cancel', brands_path, :class => 'btn' %>
    </div>
  </fieldset>
<% end %>

Error: User Rate Limit Exceeded:remote => trueError: User Rate Limit Exceeded

def create
    @brand = Brand.new(params[:brand])

    respond_to do |format|
      if @brand.save
        format.html { redirect_to brands_url, notice: 'Brand was successfully created.' }
        format.json { render json: @brand, status: :created, location: @brand }
        format.js
      else
        format.html { render action: "index" }
        format.json { render json: @brand.errors, status: :unprocessable_entity }
        format.js { render 'reload' }
      end
    end
  end

Код, который появляется подif @brand.saveError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded$("#entryform").load(location.href+" #entryform>*","");Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

  • Error: User Rate Limit Exceeded$('#target').on('click', function(e){ ... })Error: User Rate Limit Exceeded$(document).on('click', '#target', function(e){ ... })

    от
  • Error: User Rate Limit Exceeded

    от Abram
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit ExceededsoError: User Rate Limit Exceededsimple_form_forError: User Rate Limit Exceeded"data-type" => :jsonError: User Rate Limit Exceededformat.json and format.jsError: User Rate Limit Exceeded@brand.errorsError: User Rate Limit ExceededDisplay inline errors with simple_form in a Bootstrap Ajax modal

    от Mark Berry
  • 1

    Error: User Rate Limit Exceeded

    #immediate_controller
    def action_with_modal
      @brand = params[:failed_brand] || Brand.new
    end
    
    #brands_controller
    def create
      @brand = Brand.new(params[:brand]) 
    
      respond_to do |format|
        if @brand.save
          ...
        else
          params[:failed_brand] = @brand
          ...
          format.js { render 'simple_form' }
        end
      end
    end
    
    #coffeescript
    $('form-selectors-here').on 'ajax:error', @reRegister
    
    reRegister: (e, data) =>
      $("div-that-contains-form").html(data.responseText)
    

  • 0

    Error: User Rate Limit Exceeded

  • 30

    Error: User Rate Limit Exceeded

    simple_form

    $("#entryform").html("<%= escape_javascript(render :partial => 'simple_form') %>");
    

    load@brandrenderredirect_to@brand$(...).load(...)