Questions tagged [responders]
The responders tag has no usage guidance.
22
questions
0
votes
0
answers
12
views
Add user group to slack channel depending on name
Im disappointed with Jira Service Managements inability to automatically create a slack channel with responders added when we create an incident. (It can be done manually from within the incident)
I ...
1
vote
0
answers
454
views
Rails; Autoload issue after installing Sidekiq: ArgumentError (A copy of Api::V1 has been removed from the module tree but is still active!):
I have a rails (v5.1) project in development, in which I recently installed Sidekiq. I now have an autoload issue, getting the subject argument error.
I have done a fair bit of research which seem to ...
0
votes
1
answer
582
views
Getting "undefined method `flash`" for my controllers after updating Rails from 4.1 to 5.2 and added the responders gem
I'm in the process of updating rails from 4.1 to 5.2
I added the responders gem so respond_with is present.
My ApplicationController now looks like this:
class ApplicationController < ...
0
votes
1
answer
51
views
Rendering show template with Responders gem
So my question is how to render the show template only if the entity belongs to the current user. I have this code in my controller
def show
respond_with(@site) if current_user.author_of?(@site)
...
4
votes
1
answer
285
views
Responders gem: add a model's base errors to the flash message?
Is there an easy way to add a model's base errors to the flash message in the responders gem?
When I try to delete a record with depending children that has dependent: :restrict_with_error set, then ...
0
votes
2
answers
481
views
Empty body when respond_with used in Rails 5
I am trying to render a partial from a controller in rails 5 using ajax(on success) but the blank data is passed to ajax after the action renders a partial.
The Same code was working with rails4. I ...
2
votes
1
answer
2k
views
respond_with having issue with Rails 5
I am upgrading my Rails app from 4.1.1 to 5.1.4.
I am using roar-rails gem to parsing and rendering REST documents. I am facing some issues as responders gem has been extracted to separate gem.
...
5
votes
2
answers
944
views
How to customize the JSON that respond_with renders in case of validation errors?
In a controller, I want to replace if..render..else..render with respond_with:
# Current implementation (unwanted)
def create
@product = Product.create(product_params)
if @product.errors.empty?
...
1
vote
1
answer
1k
views
Rails: respond_with custom object
respond_with is acatually meant to use with ActiveModel's instances. I tried to use it with OpenStruct's instance, but it raises an error.
Is that ever possible to use respond_with with custom objects?...
1
vote
2
answers
766
views
Overriding the JSON response of respond_with for errors
I want to customize the error response of respond_with. The way it renders errors is like this:
# /app/controllers/articles_controller.rb
def create
article = Article.new(params[:article])
...
0
votes
2
answers
2k
views
Wrong number of arguments 0 for 1 unable to serialize model using devise
I am trying to create an api for my rails application in the Controllers folder I have created the following folder structure
controllers > api > v1
my routes look something like this
require '...
2
votes
0
answers
169
views
Edit view still shows after rescuing from Pundit::NotAuthorizedError and redirecting
I have a pretty standard setup: Identity::Member are users, and each Project::Project is owned by a member. I use Devise and Pundit together for authentication and authorization.
Here's my code for ...
0
votes
1
answer
600
views
Rails 4 respond_with include association with WHERE
I'm using rails respond_with to send a JSON response to the client, and I'm trying to figure out how to use the includes option in respond_with along with a where clause in my association
Here are my ...
1
vote
1
answer
263
views
Rails I18n changes apostrophe to ASCII
I'm using responders gem, and I want to show validation errors when form is not valid. In my controller I created the interpolation_action
def interpolation_options
{ resource_errors: @project_user....
0
votes
1
answer
135
views
Rails responders and Layouts
Ok, so I have a Rails app, the 'responders' gem and Ember.js.
I have set up the ember.js, I have created a model to test my app ( Lead ) and the controller/layout/view that it needs. I use Rails 4.2,...
0
votes
4
answers
901
views
Unable to return errors created on model
I'm using the gem Responders but I'm not able to show errors that I create on my models using erros.add(:base, 'Error message').
On my controller, before the respond_with @app, I debugged the @app ...
1
vote
1
answer
1k
views
Rails and respond_with: why are the status codes not right?
I'm trying to use bare bones rails controllers and have a more fine-grained control at the same time. If I'm on :new action, I respond_with my new @instance and I get a status code 200 and render the :...
1
vote
2
answers
2k
views
Using responders with a respond_with that takes a block
I was running rails 3.2.1 and using rails 3 responders as well as the flash responder available in the responders gem: https://github.com/plataformatec/responders
For some of my controller actions I ...
2
votes
2
answers
589
views
Where should custom Responders go in a Rails project?
I need to implement a custom Responder under "Module Responders", however, I am not sure where such code should live?
11
votes
1
answer
13k
views
How to respond_to PNG or JPG in Rails and generate image from HTML?
I am looking for a gem or solution to generate image in controller response.
It would be nice if it's possible to do in controller like that:
respond_to :html, :png
def show
...
respond_to do |...
8
votes
2
answers
6k
views
Including nested objects in JSON response, from MongoMapper objects
class Api::StoresController < ApplicationController
respond_to :json
def index
@stores = Store.all(:include => :products)
respond_with @stores
end
end
Returns only stores ...
1
vote
2
answers
1k
views
Set layout from responder?
I am trying to figure out how to set the layout from a custom made responder. I want to use the request.xhr? to set the layout for render to 'ajax'. Does anybody know how to do that?
I am using ...