Questions tagged [actioncontroller]

ActionController is the main controller class in Ruby on Rails.

ActionController is the main controller class in Ruby on Rails.

424 questions
4
votes
2 answers

order of before_filters in Rails controller and concerns

I have a Rails concern defined as follows: module MyConcern extend ActiveSupport::Concern included do before_filter :filter_inside_concern end def filter_inside_concern # ... end end and I have a before_filter also on the…
4
votes
2 answers

Find a newly created record in a controller test using RSpec 3 and Rails 4

I'm doing a controller spec in Rails 4, and I'm wanting to test the attributes of a record created by a controller action. How do I find the newly created record? For example, what could I do instead of it 'Marks a new user as pending' do post…
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
4
votes
0 answers

rubyzip streaming over Rails 4 Live ActionController

I want to create a zip archive on the fly while streaming it over the new Rails Live API. My problem at this point isn't the creation of the zip and sending it to the browser. It's more the problem to creating the zip on-the-fly for sending it over…
Joschka Schulz
  • 674
  • 1
  • 8
  • 18
4
votes
1 answer

respond_to do |format| format.js not working

What do I have to enable/install to get my respond_to block to return js? Rails 4.2.0 ruby 2.2 (Also tried with 4.0... I downgraded to match setup as work...) The console returns error: Processing by CameraController#show as HTML Completed 406 Not…
Peter Black
  • 69
  • 1
  • 9
4
votes
1 answer

Rails 4...Page reload after send_data

I have a method export_csv in controller. def export_csv if params[:from_date].present? && params[:to_date].present? @users = User.where("created_at between ? and ?", params[:from_date], params[:to_date]) if !@users.blank? …
Maninder Reddy
  • 107
  • 1
  • 11
4
votes
4 answers

How to do "actionSheet showFromRect" in iOS 8?

In iOS 7, I show actionSheet by "showFromRect": [actionSheet showFromRect:rect inView:view animated:YES]; But in iOS 8, this doesn't work. They they replace the implementation and suggest us using UIAlertController. Then how do I show this…
allenlinli
  • 2,066
  • 3
  • 27
  • 49
4
votes
1 answer

ActionController::UnknownFormat after update to rails 4.1

In my application_controller.rb I catch all 404s with a render_404 method: def render_404(exception) respond_to do |format| format.html { render template: 'errors/error_404', layout: 'layouts/application', status: 404 } format.all { render…
ben
  • 1,432
  • 12
  • 17
4
votes
3 answers

How to make Rails caches_page survive a capistrano deploy?

Is it possible to configure Rails so caches created with caches_page survive a Capistrano deploy? Ie, can I configure the cache to be saved into a shared directory rather than in the public directory?
aaronrussell
  • 9,389
  • 5
  • 38
  • 62
4
votes
2 answers

Action caching is not expiring correctly, even when I can see it's being called

I've got a sweeper that's supposed to expire a few action caches. Even though the debugger stops immediately before the call to expire_action, it's not actually expiring the action. Any idea what could be going on? Here are the relevant sweeper and…
btelles
  • 5,390
  • 7
  • 46
  • 78
4
votes
1 answer

Rails: Reset rendering/redirecting state

I have an exception handler (registered with rescue_from) which sometimes causes Double Render errors because the real action has already rendered/redirected before the exception is thrown. To prevent this exception, I'm looking for the modern…
mahemoff
  • 44,526
  • 36
  • 160
  • 222
4
votes
3 answers

How to check current password in Rails (Devise gem)?

I'm failing to check current password using jQuery validation. I'm using Devise gem and jQuery validation. Firebug says: the problem is in my controller : def checkpass user = User.find_by_email(params[:user][:email]) respond_to do |format| if…
MID
  • 1,815
  • 4
  • 29
  • 40
4
votes
3 answers

how to validate a record in table before saving in ruby on rails

I am new to Ruby on Rails I have a scenario in which I have a form which has some fields. One of the field values I need to validate against a table which has the data . I want to restrict the user from saving any data unless the field is validated…
Surjan Singh
  • 135
  • 2
  • 3
  • 5
3
votes
1 answer

Is it possible to avoid loading action_controller with Rails 3?

Basically I want to load this: require "active_record/railtie" require "active_resource/railtie" require "action_mailer/railtie" and not load action_controller because in this particular situation I have no use for it. Looking at the code in Rails'…
marcgg
  • 65,020
  • 52
  • 178
  • 231
3
votes
1 answer

Subclassing controllers, and when to call super

I have many controllers that will have some similar behavior, e.g. the user should be logged in, some scope needs to be set up, the current_account / current_user needs to be set and permissions cached. I am think of using a standard controller and…
Jo Erlang
  • 327
  • 7
  • 15
3
votes
1 answer

Puma webserver keeps buffering the response and sends it when calling response.stream.close

I am trying to write data to the stream at a set interval of time. class StreamController < ApplicationController include ActionController::Live def stream response.headers['Content-Type'] = 'text/event-stream' 5.times do …