Questions tagged [applicationcontroller]

61 questions
0
votes
1 answer

toplevel constant ApplicationController referenced by Children::ApplicationController

I am merging two applications school and children. Each working fine With children application nested in school application. Each of them have its own Database. Here is part of the tree for school app: app/controllers/application_controller.rb …
mamesaye
  • 2,033
  • 2
  • 32
  • 49
0
votes
1 answer

ApplicationController Functionality

I have an app with guest user functionality in it. I'm trying to understand how my applicationcontroller guest_user methods are being called. I thought I would need a before_filter in the applicationcontroller in order for them to be called but…
Steve
  • 4,446
  • 7
  • 35
  • 50
0
votes
2 answers

Postal mail server codebase; "logged_in?" method not defined in ApplicationController

I just got to know of postal a few days ago and I'm very excited about all the features it offers out of the box for free. But as a junior rails dev, I'm tempted to play around with it to see if I can add my own features. I've managed to set it up…
0
votes
1 answer

Dynamic / Regex params in ApplicationController

How to permit dynamic params in an AppicationController? so all these parameters should permitted: params = { "filter_color" => "blue,green", "filter_size" => "xl,sm,lg", "filter_type" => "new,old,used", "limit" =>…
Jan
  • 12,992
  • 9
  • 53
  • 89
0
votes
0 answers

how to call a rails controller method as js request, from application controller?

I have a controller method like this. (in home controller) def verify_email // some logic format.json { render json: { message: message } } format.js end I know that, we can call this method, by using remote true like below. as this is a JS…
John
  • 1,273
  • 3
  • 27
  • 61
0
votes
1 answer

where to rescue network connection error: in model or controller?

I have a model that requires accessing an external web site before an instance of the model can be created. What is considered best practices for error recovery? Note that since I haven't created the model, I use a class method in the…
fearless_fool
  • 33,645
  • 23
  • 135
  • 217
0
votes
1 answer

Rails: access resource model from ApplicationController

So, I've the following method in the ApplicationController, which is need to be accessed by all controllers: def alter_some_attribute @recurso = resource.find(params[:id]) ... end This method only alters a common attribute that all…
betacar
  • 416
  • 2
  • 9
  • 21
0
votes
2 answers

How to set fake request object for rails controller object

I need to use render_to_string method outside the controller. So I create controller instance like: controller = class_name.constantize.new # Rails controller instance controller.params = params controller.action_name = 'index' …
0
votes
1 answer

Convert function params to Hash object in Ruby on Rails

I have to make a change to an API developed in Ruby On Rails that looks like this: class V0::PythonsController < ApplicationController skip_before_action :authorize_request # POST v0/python/import def import result = { status: :error } …
0
votes
1 answer

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 < ActionController::API self.responder = ApplicationResponder …
0
votes
1 answer

Get Controller Object and Controller Strong Params in Application Controller

Hello people. I'm creating a log process in my Rails 5 application, inside the application controller. I'm creating there because I want to call the log process inside many controllers with a before_save property. The log will save the changes…
0
votes
1 answer

How to append URL param through controller?

In my Rails app I want to forward my users to their personal sign in page which is stored in a cookie :user_subdomain. So when a user goes to www.app.com/sign_in, s/he should be automatically forwarded to www.app.com/sign_in/mycompany. How can this…
Tintin81
  • 9,821
  • 20
  • 85
  • 178
0
votes
2 answers

How to call a function in app_controller in my elements

I am developing a website; which the users can add cars and mobiles with an one registration account. However, I have on the right and on the left boxes for the top hits (cars,mobiles), and in the middle I have the recently added cars and mobiles. I…
Hassan
  • 1
  • 1
  • 1
0
votes
0 answers

Is there any way to apply the concept of a partial to my application controller?

I put all methods that I use more than once into my application controller. This helps keep my controllers lean, except for my application controller. After years of doing this, my application controller is huge. I enjoy having the ability to break…
Jay
  • 6,206
  • 11
  • 48
  • 82
0
votes
1 answer

Run before filter an large number of actions in Ruby on Rails 4

I have lots of controller in my Rails application, and I need to use a before_filter before some actions in different controllers. The before filter will execute the same code of all these actions. Is there a clean DRY way(in application_controller…
anyavacy
  • 1,618
  • 5
  • 21
  • 43