Inherited Resources speeds up development by making your controllers inherit all restful actions so you just have to focus on what is important.
Questions tagged [inherited-resources]
99 questions
1
vote
1 answer
CanCan, InheritedResources and STI
How can I use cancan, inherited_resources and single table inheritance together?
I have code similar this example:
class Contact < ActiveRecord::Base; end
class Person < Contact; end
class Company < Contact; end
class Ability
include…

boblin
- 3,541
- 4
- 25
- 29
1
vote
1 answer
declarative_authorization's contains and inherited resources
i have rails3 app with declarative_authorization and inherited_resources gems installed. Let me show you some code from my app:
class Blog < ActiveRecord::Base
has_many :posts
has_many :memberships, :class_name => "BlogMembership"
has_many…

Alexey Poimtsev
- 2,845
- 3
- 35
- 63
1
vote
1 answer
cancan and inherited_resources overwriting collection
I think I am running into a conflict with two of my favorite gems. Consider the following:
class AccountsController < InheritedResources::Base
load_and_authorize_resource
def collection
@accounts ||=…

Jonathan
- 16,077
- 12
- 67
- 106
1
vote
1 answer
ActiveAdmin Inherited Ressource override doesn't work with multiple namespaces?
I'm using ActiveAdmin with no default namespace (config.default_namespace = false). I have a User Resource without namespace as well as an User Resource in the :admin namespace. Both use custom update methods to achieve different behavior (users can…

Florian Koch
- 1,372
- 1
- 30
- 49
1
vote
1 answer
rails passing multiple params to controller
I have a route for querying "Service" model:
resources :services, :path => 'services'
When GET requests for path /services/sn-uber i take param sn(service name) and find it in database. How to add there another param like sd(service-district)?
For…

pvf
- 82
- 1
- 6
1
vote
1 answer
How to create a nested custom page in ActiveAdmin?
I need to create a nested custom page inside a resource.
The route should be like this:
/admin/quizzes/:id/my_custom_page
The problem is that we can't use belongs_to in ActiveAdmin::Page.
I could create the route manually of course, but would be…

Theo B
- 351
- 1
- 3
- 12
1
vote
0 answers
NoMethodError (undefined method `build' for #)
I use angularjs and InheritedResources gem in my new rails project. I want use association in this project. I find Singletons for association with InheritedResources. I create 2 model and complete them like below:
districts_controller.rb:
class…

mgh
- 921
- 3
- 9
- 37
1
vote
0 answers
form_for on commentables in rails
I'm having problems with the "First argument in form cannot contain nil or be empty" error that I haven't been able to find an answer for.
Basically, I have Posts, which show up on a User's show page, which should each have the option to comment on…

Eric
- 49
- 4
1
vote
0 answers
using inherited_resource, how do you customize collections use in belongs_to relationships
Here's what I have:
https://gist.github.com/chewmanfoo/9791992
But the collections rendered in the form are as if the controller create action had not been run. (it renders Environment.all, Role.all).
I can't figure out how to customize those…

Jason Michael
- 516
- 5
- 16
1
vote
0 answers
ActiveModel::ForbiddenAttributesError: inherited_resources doesn't call permitted_params
I have a Rails 4.0.2 application which relies on nested_resources. Sadly, I'm getting an ActiveModel::ForbiddenAttributesError when submitting my form (#create). My controller looks like the following:
class VocabulariesController <…

Joshua Muheim
- 12,617
- 9
- 76
- 152
1
vote
1 answer
How to configure inherited_resources to set status for requests that fail validation
Inherited Resources seems to automatically set the status to 422 when a request fails validation and the response type is JSON. However, if the response type is html, the status is set to 200. Is there a way to tell inherited_resources to always…

cddr
- 300
- 2
- 8
1
vote
2 answers
Unable to use inherited_resources' polymorphic belongs_to with namespaced controllers
I am facing an issue with inherited_resources when using a polymorphic nested resource, one of whose parents is a namespaced controller. Here is an abstract example:
# routes.rb
resources :tasks do
resources :comments
end
namespace :admin do
…

Nilesh C
- 697
- 2
- 7
- 17
1
vote
0 answers
Flash message is not showing up when Inherited_resource gem used
When I use the default IC action in my controller like this:
def update
update!(:notice => "Order has been updated."){edit_sales_order_path(@sales_order)}
end
the notice doesn't show up in my json response. But if I overwrite the…

user1883793
- 4,011
- 11
- 36
- 65
1
vote
1 answer
WARNING: Can't mass-assign protected attributes: name Strong parameter
I am using Rails 3.2.14, inherited_resource and strong_parameter gem.
Commented out
#config.active_record.whitelist_attributes = false. in production.rb
#config.active_record.mass_assignment_sanitizer = :strict in developemt.rb
Added this to…

user1883793
- 4,011
- 11
- 36
- 65
1
vote
1 answer
Can we use a custom action with inherited_resources in a DRY manner?
We have a custom action (:register) for our Location model. The supporting code is very similar to a standard :update. Since inherited_resources provided a "template" for us, we copied the update code from actions.rb, changing 'update_attributes'…

Matt Scilipoti
- 1,091
- 2
- 11
- 15