Questions tagged [inherited-resources]

Inherited Resources speeds up development by making your controllers inherit all restful actions so you just have to focus on what is important.

99 questions
3
votes
1 answer

What is the mechanism of 'end_of_association_chain' in 'Inherited resources' gem

Inherited resources is a powerful gem that I can use it to avoid a lot of repeating things. But i still don't understand why it can get a object through end_of_association_chain even i did not pass anything related to its belongs_to model
Perpherior
  • 201
  • 1
  • 9
3
votes
0 answers

ActiveAdmin / Inherited Resources looking for invalid route when using nested resources. Only on server, not locally

I have a Rails 4 app using ActiveAdmin and nested resources. Everything is working fine on my local development version, but when I deploy to a server (Ubuntu LTS 12.04) I'm having a problem. I have an ActiveAdmin configuration…
Colin
  • 784
  • 2
  • 8
  • 21
2
votes
1 answer

How do I define default respond_to for index & show action in application controller?

I was wondering is there any way to define default respond_to for index & show actions in Application Controller with an ability to override in other controllers that need some customization. I think it's going to be easier with an example. I'm…
konung
  • 6,908
  • 6
  • 54
  • 79
2
votes
2 answers

Searching / Ordering data with inherited_resources in Rails

Is there a popular gem that makes it easier to build an admin interface in Rails that lets you search and order data? Bonus points if it integrates well with inherited_resources. I don't want to use something as heavyweight as activeadmin. Looking…
Joe Van Dyk
  • 6,828
  • 8
  • 57
  • 73
2
votes
1 answer

inherited_resources, right way to render with validation errors

I googled for a long time, but didn't find full answer for my problem. In my app I use inherited_resources. So, I want to override redirect after succefull creation of Comment object, so I write: update! do |success, failure| success.html {…
link_er
  • 472
  • 3
  • 11
2
votes
1 answer

RSpecing :update action for a nested resource

Author has many works. Work belongs to author. resources :authors do resources :works end And the RSpec: it "should redirect to :show" do work = FactoryGirl.create(:work) controller.stub(:resource) { work } …
Mirko
  • 5,207
  • 2
  • 37
  • 33
2
votes
2 answers

Render a polymorphic partial with optional belongs_to/nested inherited resources (Rails 3.1)

Trying to do something really simple--could someone please provide the correct incantation? Basically we have Biscuit optionally nested in User so we'd like routes like: /biscuits /biscuits/1 /users/2/biscuits /users/2/biscuits/3 etc. We have views…
tribalvibes
  • 2,097
  • 3
  • 25
  • 30
2
votes
1 answer

Nested Objects with Inherited Resources

First off, I love inherited_resources Consider the following: class Job < ActiveRecord::Base has_many :inputs, dependent: :destroy has_one :output end class JobsController < InheritedResources::Base respond_to :json end When I request…
Jonathan
  • 16,077
  • 12
  • 67
  • 106
2
votes
0 answers

Inherited Resources: can't get the parent in a polymorphic_belongs_to

I am using Inherited Resources in my Rails application but I have an issue: I can't access the parent object when I use a polymorphic relation between my controllers. Following the documentation, I have a controller like this: class…
Fabien
  • 21
  • 3
2
votes
1 answer

Inherited Resources and optional belongs_to: How to scope collection in parent resource, but not in nested resource?

I have the following routes: resources :boilerplates resources :projects do resources :boilerplates end The Boilerplate model looks like this: class Boilerplate < ActiveRecord::Base scope :originals, -> { where(prototype_id: nil) } end My…
Joshua Muheim
  • 12,617
  • 9
  • 76
  • 152
2
votes
1 answer

Does Kaminari Work with Inherited Resources?

Does anyone know whether the Kaminari gem works with Inherited Resources, because I'm trying to keep my code dry and don't want to repeat myself? What the plan is, is to render 3 different tables i.e. an Errors table, Messages table and Subscribers…
Joe Hilton
  • 261
  • 1
  • 4
  • 13
2
votes
0 answers

Setting instance variable to parent in inherited resources

I'm trying out IR and im having some issues setting an instance variable to a nested parent object. For example, I have a professional model that has many projects. In my projects controller, I have this: class ProjectsController <…
JoshL
  • 1,397
  • 1
  • 12
  • 28
2
votes
3 answers

Showing index to current user, only their information

I have a model Order. In the index, I want the current_user to see the index with only their orders. Order belongs_to :admin_user. AdminUser has_many :orders. I am using activeadmin in my app, if that makes a difference. I am getting this…
2
votes
1 answer

set current user when creating a comment with inherited_resource rails

I am using Rails Inherited_resource gem in my comments controller, and comments is a nested resource so: resources :projects do   resources :comments do end I also have a belongs_to in the comments controller: belongs_to :project, :finder…
user1883793
  • 4,011
  • 11
  • 36
  • 65
2
votes
1 answer

custom destroy/edit functions in rails active admin

I'd like to add some custom code to the destroy and edit default actions in active admin. Essentially, when I edit or delete a member, I want to sync that action with a copy on an external database. I could either do a redirect to a custom method…
econclicks
  • 327
  • 1
  • 5
  • 11