Displaying 20 results from an estimated 20000 matches similar to: "respond_with and ajax"
2011 Sep 07
4
jquery and ajax query in rails 3
hi people
I don''t know much about ajax - jquery. And right now I need to use
some functionality with them.
In a form (sales model) I have the following code:
<div>
<%= f.label :product_id, "Product" %>
<%= f.collection_select( :product_id, Product.all, :id, :name,
options={} ) %>
</div>
<div>
<%= f.label :price,
2010 Nov 21
0
api respond_with json
Hello,
So let say I created this class with the following method that responds
to xml or json.
class UsersController < ApplicationController::Base
respond_to :html, :xml, :json
def index
respond_with(@users = User.all)
end
def create
@user = User.create(params[:user])
respond_with(@user, :location => users_url)
end
end
How do I call the create action from another
2011 Mar 22
0
Error on ajax forms/links in jQuery UI tabs
I''ve implemented jQuery UI tabs, and I get an error:
When i submit a ajax form or link, it gets submitted multiple times.
As seen in this Doom console output:
DELETE http://localhost:3000/innmeldings/101 404 (Not Found)
DELETE http://localhost:3000/innmeldings/101 404 (Not Found)
DELETE http://localhost:3000/innmeldings/101 404 (Not Found)
DELETE http://localhost:3000/innmeldings/101
2011 Jan 15
3
respond_with javascript
My ajax stopped working when I switched to using respond_with. For my
Votes, I have the create action and the corresponding create.js.erb,
and respond_to :html, :js, :xml in the controller. Heres the log when
I try and create a vote:
Started POST "/stories/3-asdfasdf1111/votes" for 127.0.0.1 at Fri Jan
14 20:46:36 -0800 2011
Processing by VotesController#create as */*
Parameters:
2010 Sep 05
0
Responding to a non-registered MIME type?
I''m trying to figure out how attachments are supposed to work with MIME
type-based responses. What makes attachments special is that in many
cases they are allowed to be arbitrary files. It would be too
restrictive to require that all possible types are registered
(Mime::Type.register).
Let''s say for GET requests on an attachment resource I want to return
metadata if the
2010 Aug 28
0
Rails 3 rendering XML problem
I have Rails 3 application (running Rails RC1), and I have the following
controller:
class PluginsController < ApplicationController
respond_to :html, :xml, :json
def index
@plugins = Plugin.all
respond_with(@plugins)
end
end
If I try to render http://localhost:3000/plugins it works fine, showing
me the HTML version. If I try to get http://localhost:3000/plugins.json,
it also
2010 Jun 23
0
Rails 3 - AJAX Response
Hi,
I need help with some AJAX in rails 3.
So basically, I have a select option in my index page for my User
model. This select option is a form that modifies the user''s type. The
" :remote => true " works and the type is changed when hit the submit
button. But, nothing happens in the browser. The user is updated.
I''m actually not sure where to put either my JS /
2006 Nov 13
5
Routes problem
I want to connect default route to controller Report::SalesController,
so I have line:
map.connect '''', :controller => ''report/sales''
in config/routes.rb
SalesController is in app/controllers/report/sales.rb
and is declared as:
class Report::SalesController < ApplicationController
...
end
The problem is that when I try to open root url of my application I
2013 Feb 01
0
Add a customer renderer but I get missing template
Hi,
I''m trying to include the support of Msgpack<https://github.com/msgpack/msgpack-ruby> in
Rails 3.2 but when I try to return a mpac response, I get an error
concerning a missing template.
My renderer:
Mime::Type.register ''application/x-mpac'', :mpac
ActionController::Renderers.add :mpac do |mpac, options|
self.content_type ||= Mime::MPAC
2011 Sep 06
8
Ajax and rails 3 UJS (jquery)
Hi, guys,
I''m in the midst of moving an app from rails 2.3.8 to rails 3.0.9.
Sadly, rails 3 no longer has javascript generators and I''m now forced
to do more javascript.
For my project, I have selected jQuery as the javascript framework for
my rails 3.0.9 app.
What I have done to have my app''s deletion link (for each item)
trigger an alert box when the deletion
2006 Jun 13
1
AJAX based record deletion
Hi,
New to RoR and I just wanted to check the correct process flow for
this...
I presently have a controller action:
def destroy_category_association
category = CatalogueCategory.find(params[:id])
product = Product.find(params[:product_id])
product.catalogue_categories.delete(category)
end
I display a list of categories assigned to a product, some of which I
may wish to delete
2013 May 23
1
problem of respond_with working on nested resources
hi all:
when using namespace or nested resources in routes.rb,such as
"namespace :admin { resources :books }, we can use [:admin,@book] way to
generate path. It works fine in form_for , but when I use it with
respond_with in controller, I get problems.
The problem is when I put following code in controller:
def create
@book=Book.find(params[:id])
2011 Jan 11
9
Can I omit respond_with.
If I don''t want xml results but only html can I omit respond_with in
some actions?
For example index from:
respond_with(@sectors = Sector.all)
becomes only
@sectors = Sector.all
isn''t it?
--
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
2010 Jul 04
1
Rails 3: ActiveRecord .include not working
Really no idea what''s up...
class Auction < ActiveRecord::Base
has_and_belongs_to_many :categories
end
class Category < ActiveRecord::Base
has_and_belongs_to_many :auctions
default_scope order(''title'')
scope :active, where(:active => true)
end
class CategoriesController < ApplicationController
respond_to :html, :json
# GET /categories/:id
2011 Feb 03
0
Correct way to exclude attributes from json serialization
Hi
I''m using Mongoid and Rails 3, and I want to serialize one of my
mongoid documents to json for publishing via a controller, e.g.
class ReportController < ApplicationController
respond_to :json
def show
report = Report.where(:report_id => params[:id]).first
respond_with report
end
end
This works ok, but pushes out every attribute on the document
2011 Nov 29
1
ajax question
Hello,
could you please explain what''s wrong with this code:
Rails 3.1.1
skills_controller.rb
class SkillsController < ApplicationController
# GET /skills
# GET /skills.json
def index
@skills = Skill.all
respond_to do |format|
format.html # index.html.erb
#format.json { render json: @skills }
format.js
end
end
end
index.html.erb
<%=
2012 Sep 18
4
"best practices" for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.
I''ve been writing a gem to implement and extend common controller
functionality so that Rails can be used with Javascript frameworks like
AngularJS (which we are using), Ember.js, etc. in such a way that the user
doesn''t have to tweak a a bunch of rails g controller boilerplate code to
provide services for use in these frameworks that in turn would require
various changes to
2010 Jun 27
0
[rspec-rails-2] conflict with view isolation and respond_with
Hey all,
For those of you interested in view isolation in controller specs, an issue has been reported with ActionController''s new respond_with method. Please take a look at http://github.com/rspec/rspec-rails/issues/103 and add comments if you have any thoughts on the matter.
Thanks,
David
2011 Aug 15
2
respond_with with templates and http status when creating an object
Hi.
When you use respond_with in a controller #create method and want to render
XML the response gets the http status 201 (Created).
But if you use a view to render this XML response_with uses the status 200
(Ok), for example when you use the gem rabl.
I cannot determine if this matter is related to Rails or rabl. If it''s from
Rails, is there a particular reason for this behavior?
2012 Mar 06
0
Devise/Cancan Signout User On Controller Action
I have implemented Devise for Authentication and Authorization in ROR
application everything seems fine but getting one issue. I have two
modals "Account" and "Transactiona" , and so two controllers
respectively.
My Transaction Index view call one of Account Controller method like
this