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
0
votes
1 answer
RESTful nested conventional routing
I have the model:
User -1---n- Transaction(amount,description, date)
User -1---n- TransactionImport -1---n- TransactonImportField(name,value)
(personal expense tracking app).
What I want to achieve is this:
User opens URL and pastes the CSV with…

Dmytrii Nagirniak
- 23,696
- 13
- 75
- 130
0
votes
2 answers
Stuck in parsing URL and work with it in a view
Trying to parse a URL with this format http://landing.com?data=123 - I'm been able to get the Data through irb like:
require "addressable/uri"
uri = Addressable::URI.parse("http://landing.com?data=123")
uri.query_values['data']
=> '123'
But I'm…

malditojavi
- 1,074
- 2
- 14
- 28
0
votes
1 answer
Inherited resources parent helpers - Rails
In the README for the inherited_resources gem it says the below associations allow the use of helpers such as parent #=> @task
class CommentsController < InheritedResources::Base
belongs_to :project {
belongs_to :file, :message, :task,…

Robbo
- 1,292
- 2
- 18
- 41
0
votes
0 answers
View specs: Devise overrides the helper "resource_class" of InheritedResources
I have the following view spec:
RSpec.describe "boilerplates/index", type: :view do
it "Doesn't render empty topic" do
assign :boilerplates, [create(:boilerplate_original, topic: nil)]
render
expect(rendered).to have_css('.topic',…

Joshua Muheim
- 12,617
- 9
- 76
- 152
0
votes
0 answers
How to enable two kinds of URLs http://ip:port/questions/:id and http://ip:port/questions/:id/:slug simultaneously?
I used stringex to implement a more friendly url, like in stackoverflow, now I enable my url as follows:
http://localhost:8000/questions/12/i-want-to-display-the-url-like-stackoverflow
Of course, I found SO steps further, when entering…

abelard2008
- 1,984
- 1
- 20
- 35
0
votes
1 answer
Ruby on Rails Inherited_resources multiple belongs_to
I have a comments_controller that uses inherited_resources and deals with this models:Comment (belongs_to Shop and belongs_to User), and Shop (belongs_to User).
Rails 4.1.1 and Inherited_resources v is 1.5.0.
Routes are:
resources :shop do
…

Al17
- 431
- 7
- 20
0
votes
1 answer
setLayoutParams on Inherited View
Am having trouble with my android application. I wanna create a new View by doing this :
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected…

Noémie O'connor
- 7
- 2
0
votes
1 answer
inherited_resources alternate create method forbiddenattributes
I have two create methods (maybe could be structured better, but new to inherited_resources)
Basically, I want to redirect to a different page after create, I am getting a ForbiddenAttributes error using one method, but not the original Create…

Craig McGuff
- 3,968
- 6
- 30
- 35
0
votes
1 answer
has_many :through association with inverse added twice
I've created a sample application that enlighten my issue.
Basically, I have a many-to-many association with a STI class:
class Basket < ActiveRecord::Base
has_many :basket_fruits, inverse_of: :basket
has_many :fruits, through: :basket_fruits
…

ybart
- 876
- 8
- 23
0
votes
2 answers
Get name of a resource currently loaded in TImage component - Delphi XE3
I've been looking around but haven't found anything specific...
I built a resoruce file containing about 100 small png images, and I load them randomly all over the app.
I then have OnClick event on every TImage component, where I do get the…

That Marc
- 1,134
- 3
- 19
- 42
0
votes
0 answers
CanCan and InheritedResources: load and authorize resource through a singleton resource without ID param in the URL
My users can define their own vocabularies.
class User < ActiveRecord::Base
has_many :vocabularies
end
class Vocabulary < ActiveRecord::Base
belongs_to :user
end
Routes:
resource :user do
resources :vocabularies
end
Now I want to use CanCan…

Joshua Muheim
- 12,617
- 9
- 76
- 152
0
votes
2 answers
Rails 4 Inherited Resources throwing ConstraintException when posting
I have a pretty simple model called Deal with name and description where name is non-nullable.
When I post the following to /api/deals
{"name":"oaeu"}
I get the error
SQLite3::ConstraintException: deals.name may not be NULL: INSERT INTO "deals"…

Emad
- 4,110
- 5
- 30
- 35
0
votes
1 answer
Inherited Resources + Devise User, #new missing required keys: [:id]
I have an issues with using the Inherited Resource Gem on rails 4:
whenever I try to create a new project that is scoped to the user I get this error:
Failure/Error: visit new_project_path
ActionView::Template::Error:
No route matches…

Rtype
- 886
- 11
- 32
0
votes
1 answer
inherited_resources gives wrong resource_path
I'm using Rails 3.2.16 and inherited_resources 1.4.1. I needed a fast ad custom admin, so I used this post as example (it's still valid for rails 3.2):
http://iain.nl/backends-in-rails-3-1
This is what my routes files looks like:
namespace…

mrcasals
- 1,151
- 10
- 20
0
votes
1 answer
How to create a namespaced model instance in Rails 3
I have this model:
class Backend::Enterprise < ::Enterprise
How could I call and instantiate this model in its namespace?
If I write, in backend_enterprises_controller:
@enterprise = Enterprise.find(1)
It calls to the model:
class Enterprise <…

CV-Gate
- 1,162
- 1
- 10
- 19