similar to: Key Value Json ActiveModel::Errors

Displaying 20 results from an estimated 40000 matches similar to: "Key Value Json ActiveModel::Errors"

2012 Jun 21
1
ActiveModel::Serializers::JSON support arbitrary keys
Is there a reason why AM:S doesn''t support arbitrary keys to serialization? I can see a lot of uses cases where arbitrary keys could come handy. Right now, if one tries to do it, AM:S checks if the keys match a method of the model and raises exception if it can''t find any. class Client < ActiveRecordBase attr_accessible :name, :address, as: :creator include
2010 Sep 26
1
Rails 3 basic Get JSON with jQuery and output on the page flow question
Rails newbie, thanks for help with this hopefully basic JSON type question.... I have a model Books in my app, which belong_to users. What''d I''d like to learn how to do, is use jQuery to get a JSON object of the books that the user owns (current_user). And then use jQuery to list the results out on a div (id=targetdiv). Where I''m not certain, is this something Rails 3
2010 Nov 06
0
Rails and JQuery and Ajax/Json question
Hi, I am using JQuery in my rails app. I''ve taken the approach outlined in Ryan Bates''s Railscast on jquery to do the following: jQuery.ajaxSetup({ ''beforeSend'' : function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} }); to set my ajax call request Headers to text/javascript so that my respond to block for javascript is
2010 May 28
0
Rails and JSON example?
Does anyone know of a demo or tutorial in which ... (1) In a browser some data is packaged up using JSON. (2) an async request is sent to a rails app sending the JSON data. I would like this to be done via jQuery. (3) A rails app deserializes the JSON data. (4) The Rails app then packages up some other data using JSON, again (5) The Rails app sends this data back to the browser. (6) jQuery
2010 May 28
1
cookie has key/value pairs and lost order after JSON decode
If a cookie has several items, and is encoded as JSON text as the value of the cookie, the order is actually apparent in the cookie''s text But if JSON.decode is used: ActiveSupport::JSON.decode(cookies[''item_list'']) and the result is actually in a hash, then the ordering is lost... Is it true that if the original JSON object has an array of hashes (1 key and 1
2012 Feb 20
1
respond_to format.json not being called
Hi all, I''m submitting a form using jQuery, but in the respond_to block only the format.html action is called. This is the javascrip: send_button.on(''click'', function(){ var form = $(this).closest(''.modal'').find(''form''); $.post(''/messages'', form.serialize(), function(data, status, xhr){
2010 Oct 31
0
Error in rendering json
Hello, in my controller I use following code to render json. render :json => @product, :callback => params[:callback] I would expect (for example) following to be rendered: callback({"name":"Computer","price":500}) Instead, it renders: callback([{"name":"Computer","price":500}]) Notice the square brackets which disables
2010 Apr 09
0
[PATCH] add :root option to ActiveModel JSON serialization
This is a small, straightforward patch that I''d love to see merged: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4358-patch-add-root-option-to-activemodel-json-serialization It''s all pretty self-explanatory, it basically just ports a useful option from to_xml to to_json, making their interfaces more compatible with each other. Feedback would be greatly
2014 Apr 14
0
Foundation & Authlogic
Seems I can get either Foundation or Authlogic to work but not both - After bundle install when I do a rails g foundation:install I get the following: C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.1.0/lib/acti ve_record/dynamic_matchers.rb:26:in `method_missing': undefined local variable o r method `inheritable_attributes' for ActiveRecord::Base:Class (NameError)
2012 Aug 19
0
Unsuccessful with using mongodb with rails
I have had a frustrating time trying to get mongodb to work with Rails (works just fine with a plain Ruby app). cannot load such file -- mongo The error is traced to the code line <requires ''Mongo''>. bundle initialize shows I have it all. Any ideas? Thanks, Shiv $ bundle install Using rake (9.2.2)
2012 Jan 15
2
DEPRECATION WARNING: Passing a template handler in the template name is deprecated. (rspec + haml)
I upgraded a small project that I had created on 3.1.3 to 3.2.0.rc2. Running rspec on it brings about a large amount of these messages: DEPRECATION WARNING: Passing a template handler in the template name is deprecated. You can simply remove the handler name or pass render :handlers => [:haml] instead. (called from block (2 levels) in <top (required)> at
2012 Jan 17
0
What is the best way to validate a json object? (POST request)
I must create a class (JobClass) and include ActiveModel::Validations? and then valided = JobClass.new(params).valid? The JSON body : http://pastebin.com/TwRbydmq I can not create rules corresponding to the validation of the field "method" ... It can be "concat" or "split" but it is not the first level. How can I do? Thanks -- Posted via
2012 Jun 14
1
Cucumber/RSpec ::: Capybara? Webrat What am I using??
Hey everybody I''m currently reading through the Pragmatic Programmers RSpec book, and I really enjoy it. But I’m facing some problems because of the fact that the book is already some years old, I guess. I have installed rvm and use Ruby 1.9.3, and I didn’t really get some Rails code examples to work properly, so I tried it with a 1.8.7 installation, but there I had some other problems
2010 Aug 13
2
Rails 3 / ActiveModel for Credit Card information?
When submitting billing information in the past I''ve always used attr_accessor for credit card details as they should not be saved in the database. In addition I always end up storing the card expiration date so that the date form helper works correctly. With Active Model it seems logical to create a CreditCard class to hold this data instead. **1st issue.** It seems there still
2013 Jul 19
0
Integrate jquery Grantt with my app in rails
Hi! I made a app in rails and have registed somethings... i would integrate jquery grantt with my app in rails. https://github.com/robicch/jQueryGantt Its is the project jqueryGrantt, he generate a json. I think that i could build a JSON with rails and integrate with the grantt... but, how? Thanks! -- You received this message because you are subscribed to the Google Groups "Ruby on
2010 Jun 24
0
Rails3: render_to_string of a .html.erb when request is a json request raises MissingTemplate error
I''ve the following situation (which actually works in Rails 2.3.8 and this is a result of the migration of our app to rails3): I have a partial which is rendered a few times (imagine tr''s in a table). On the clientside there''s a script that does a json request for a specific row (jQuery + ajax dataType: ''json'' and type: ''POST'') In
2013 Jul 21
4
how to use activemodel collection.build for a has_many :through association
Hi all, In my controller I am doing the following to populate a nested form for a has_many through association: def new @specification = Specification.new Component.find_each.each do |component| @specification.component_specifications.build(:component_id => component.id) end The idea being whenever someone creates or edits a form, it will be populated with all
2010 Jun 08
8
rails, ajax, json, and script
Could someone please demonstrate the code to send both json (or xml) AND javascript (to be executed) in a single Ajax request? Is this even possible? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2012 Oct 21
0
rails g problem
When I enter rails g, I get the bunch of logs behind. Any idea what I''m missing? I though it''s trying to install minitest, so I manually installed it. Still this error persists. $ rails g gem install minitest /Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'': no such file to load -- minitest/unit
2012 Sep 22
1
formtastic does not save at all
Rails 3.1.3 I am using Formtastic gem in order to deal with multi-select dependencies. <%= semantic_form_for(@give) do |f| %> <%= f.inputs do %> <%= f.input :departure, :collection => Departure.find(:all, :order=>:city).collect{ |c| [c.city,c.id]}, :required=>true %> <div id="destinationCity"> <%= render :partial =>