How can we add same_site attribute on rails 4 application? - ruby-on-rails-3

I have rails 4 application and I see now crome is expected to not supporting cookies without same_site attribute.
My application is iframe-based and I have tried to add
response.headers['Set-Cookie'] = 'Secure;SameSite=None'
in ApplicationController < ActionController::Base class on before action filter but it not working sill my session object not set to same_site attribute
can someone help me how we can set the same_site attribute without upgrade my rails version.

Related

Construction #User.IsInRole("admin") return only false

I have got a short question: recently I have created a web application in ASP.NET Core 3.1, where I have been using Identity framework to authorize/autenthize of an user.
In navigation part of page I would like to display a role of user, so I wrote following code snippet in partial view:
#if (User.IsInRole("admin") {...}
But there is a problem, mentioned construction permanently returns "false".
Any idea to fix this error?
Thank you very much.

undefined method `devise_controllers?'

I am trying to use paperclip 3.5.1 with devise 3.1.0 in a Rails 4 application.
I wanted to be able to add an avatar for my User devise model, so I generated the required fields but I have problem in the showing and saving the picture.
I tried the solution given here but when I try to load a url now I get for every controller that I have the following error. It even appears for the RegistrationController.
undefined method `devise_controllers?' for #<__Some__Controller:_____>
Why does this happen and how can I solve it? I couldn't find any solutions online and since it is my first rails application I'm not so familiar with it yet.
This is just a typo: the name of the helper is :devise_controller?, notice the extra "s" you have there: rubydoc reference

Can't Disable Controller Class Caching in Rails 3.2

I'm developing a Rails app using the rails s WEBrick server. For some reason, even though I'm in development mode, one of my controller classes looks like it's still being cached since the controller's class variable values are persisting between page requests.
Is this an expected behavior, considering that in my config/environments/development.rb file, I have the following settings?
config.cache_classes = false
config.action_controller.perform_caching = false
Thanks!
UPDATE: Really, I'm mostly looking to understand why the controller's class variables continue to store their values between page requests when I'd expect those values to be cleared every time I navigate to a new page.
By default, Rails reloads classes only if they change. This can be changed by setting
config.reload_classes_only_on_change = false
This should reload the classes on every request and reinitialize the class variables.

how ActiveAdmin works with existing controllers

I'm finding it difficult to understand how ActiveAdmin(http://activeadmin.info/) works with existing controllers
I have the following controllers
app/controllers/projects_controller.rb
and I was successfully able to implement ActiveAdmin UI over my views in the above controller. But my question is I have added the following before_filter in my controller
class StaticContentsController < ApplicationController
before_filter :list_content_types
def index
#static_contents = StaticContent.all
end
end
But this filter seems to be not executing, in fact I changed the code inside the index method to
#static_contents = abc StaticContent.all
As it should give and error because of 'abc' section, but surprisingly my app works with out an error. My guess is 'ActiveAdmin' reads controllers my its own, not the existing ones
this is my index action path
http://localhost:3000/admin/static_contents
and this is in development mode
Can someone help me on understanding how controllers works with ActiveAdmin or am I missing something here
Following are my configs
rails (3.0.0)
ruby 1.8.7
activeadmin (0.3.2)
thanks in advance
sameera
Activeadmin controllers are not the same as your app's controllers, they are separate. The reason your code is not causing an exception from the activeadmin interface is because that code is never hit. The activeadmin controller documentation specifies how to modify the default activeadmin actions.

How to override inherited_resources with the rails scaffold command

I am using the active_admin gem in my Rails 3 application, which has as a dependency inherited_resources. I am somewhat of a newb and would rather avoid the black box qualities of inherited_resources for my own controllers, however, when I run the default rails g scaffold command, the controllers that are generated are inheriting from inherited_resources. I know that I can manually override this by inheriting from ApplicationController, however, I would like to be able to generate the default rails scaffolds if possible.
-c=scaffold_controller
or add this to config/application.rb
config.generators do |g|
g.scaffold_controller "scaffold_controller"
end
Also noted in an issue thread over at github: https://github.com/josevalim/inherited_resources/issues/195