Displaying 20 results from an estimated 30000 matches similar to: "Problem with nested route in namespace (Rails 2.1.1)"
2010 Mar 24
0
form_for with nested shallow route
Let''s say I have:
map.resources :teams do |team|
team.resources :squads, :shallow => true
end
When I want to generate a form_for a squad, I need both the team and
squad for new/create, but only the squad for edit.
This means I need:
edit:
form_for(squad)
new:
form_for([team, squad])
This seems not very dry. Is there a more idiomatic way of doing this?
Right now,
2010 Feb 10
1
namespace + nested resources = <% form_for ... %> problem
Hello all
I wrote a gist, which describes my problem: http://gist.github.com/300860
What param I need to pass to form_for? Thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
2007 Dec 28
1
Nested resources form_for problem
Hi,
I have a resource map like this:
map.resources :users do |user|
user.resource :sreg10record
end
So a User is supposed to have (at most) one Sreg10record. The problem
is in the views. I tried following this tutorial:
http://www.akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial
which proposes something like:
<% form_for( [@user, @sreg10record] ) do |f|
2009 Jun 20
0
[Rails 2.3] nested_attributes and validation of nested model
Hi,
I''m using nested models to create form in my view. It looks like this:
<% form_for :user, :url => {:action => "add_owner" }, :html => {
:method => :post } do |u| %>
<li><label>Name: </label><%= u.text_field :name %></li>
<li><label>Surname: </label><%= u.text_field :surname %></li>
<%
2010 May 23
1
[Rails 3] Trouble with named routes and form_for
Hi guys,
I''m having trouble getting named routes and form_for to play nicely in quite the way I would expect. Here''s a quick summary of what I''ve got going on:
Named route:
resources :thread, :class_name => "forum_thread"
Controller name:
forum_thread_controller
Model object:
forum_thread
In both my new and edit actions I''m setting up an
2007 Dec 10
11
map.namespace, rake routes yields no POST URLs
routes.rb
map.namespace :admin do |admin|
admin.resources :cupcakes
end
rake routes
cupcakes GET /cupcakes
formatted_cupcakes GET /cupcakes.:format
POST /cupcakes
POST /cupcakes.:format
That said, what the heck goes here:
form_for(:cupcake, @cupcake, xxx_url) # ???
Calling create_admin_cupcake_url yields...
undefined local variable
2009 Jul 01
2
Nested Forms - how to displayed the attributes content ?
I have a User model
class User < ActiveRecord::Base
has_one :account
accepts_nested_attributes_for :account, :allow_destroy => true
validates_associated :account
attr_accessible :account_attributes
is working fine, validating and updating both records (User and
Account), but I caanot display the value in the form when is updated,
ex: below the firstname is not displayed but
2010 Apr 18
0
Rails 3: new namespace inside nested resource?
Hi,
Is there a way to use namespaces inside nested resources? For example,
I have:
resources :users do
resources :tags
end
and I''d like to place the tags controller inside controllers/users,
with the equivalent for templates.
If I try this:
resources :users do
namespace :users do
resources :tags
end
end
I''ll get redundant route names:
users_user_tags,
2008 Oct 30
1
Nested Resouces,not getting parent id(project_id) from form
Hi
i am using nested resources,here project having has many relation with
defects.
Main problem here is i am not getting project_id from edit form.What''s a
problem if any one knows please help.
edit.html.erb
<% form_for(@defect,@project) do |f| %>
<%=f.text_field :name%>
<%end%>
routes.rb
map.resources :projects,:has_many=>:defects
map.resources :defects
2009 May 12
2
2.3 Nested Model Forms; build new without updating existing
I''m trying to build something similar to a Facebook messaging app, in
which the view displays all the messages for a particular thread, with
a form box for replying at the bottom of the thread.
The problem is that using fields_for generates form fields for each
existing record, and for one new record. In this case, there is no
need to edit existing messages - just a need to add new
2018 Feb 05
2
[PATCH 0/1] drm/nouveau/disp: prefer identity-mapped route of SOR <-> macro link
Hi Ben,
still _assuming_ it's an issue of the card I thought about why it
works with the NVIDIA binary driver.
And I can image they're just trying to do an identity-mapping first
and if that doesn't work (e.g. the particular SOR is already in use
by another macro link) they just pick the next suitable one.
So the case would be that the NVIDIA binary driver always assignes
the only
2013 May 23
1
problem of respond_with working on nested resources
hi all:
when using namespace or nested resources in routes.rb,such as
"namespace :admin { resources :books }, we can use [:admin,@book] way to
generate path. It works fine in form_for , but when I use it with
respond_with in controller, I get problems.
The problem is when I put following code in controller:
def create
@book=Book.find(params[:id])
2009 Feb 09
2
how to get form parameters while using fields_for with nested attributes
hi all..
i am trying to use *fields_for* to get and save nested attributes in a form.
i have a ''Partner'' model associated with an ''Address'' model.
partner has_many :addresses
although the form is displaying fine, but on submitting it the following
error is shown:
*can''t convert HashWithIndifferentAccess into Array*
on this line:
*@partner =
2009 Nov 18
4
rails newbie : routing error
After much ado about the naming of model adn controllers...
model : Expense
controller : Expenses
route : map.resources :expenses
Here I am using mysql database and created a unique index, since
db:migrated created an id object and made it as primary key. Now in
the
def create
@expense = Expense.new(params[:expense])
if @expense.save
flash[:viola] = ''New expense saved.. be
2007 Feb 27
0
Simply_helpful and nested resources
Hi all,
my question is Does simply_helpful is ready for use with nested
resources ?
I''ve tried something like :
# Routes.rb
map.resources :projects do |projects|
projects.resources :iterations
end
# edit.rhtml
<% form_for(@project, @iteration) do |f| %>
# => <form action="/projects/1/iterations/3;edit" method="post">
# new.html
# =>
2012 Apr 05
0
Polymorphism, acts_as_relation gem and nested attributes
I have the following polymorphic association set up with
acts_as_relation (https://github.com/hzamani/acts_as_relation)
Model code:
class Email < ActiveRecord::Base
belongs_to :detail
validates_presence_of :address
end
class Detail < ActiveRecord::Base
acts_as_superclass
has_many :emails
accepts_nested_attributes_for :emails, allow_destroy: true
2011 Aug 22
0
Paperclip nested resources problem
My models:
class Country < ActiveRecord::Base
has_many :regions
has_many :assets, :dependent => :destroy
accepts_nested_attributes_for :assets
end
class Region < ActiveRecord::Base
belongs_to :country
has_many :appartments
has_many :assets, :dependent => :destroy
accepts_nested_attributes_for :assets
end
class Asset < ActiveRecord::Base
belongs_to :region
2009 Mar 16
2
nested forms in rails 2.3
Hi,
Is there a simpler way to implement the view-component of nested forms
as it was done in Railscast #75 (Complex Forms Part 3) in Rails 2.3?
I''d like to add and remove the owned objects dynamically using AJAX
requests, but using f.fields_for :object do |object_form| doen''t let
me load new objects into the form - or at least I don''t fully
understand how that should
2012 Feb 03
0
Rails 3: Route all POST to :update method for a specific namespace
Against the background of the PUT/PATCH/POST partial update discussion
( https://github.com/rails/rails/pull/505 ):
Actually I want to use the PATCH method in Rails but it is not yet
implemented. So can I define (for a whole namespace) that THIS is
standard behavior:
POST resource/:id => :update
?
--
You received this message because you are subscribed to the Google Groups "Ruby
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone,
I am relatively new to rspec and I am running into a wall in testing my
views. I have a RESTful resource Contracts with a nested resource of
Line_items.
I am trying to figure out how to test the "edit" form of the Line_items.
What complicates this is the nested routing and how to account for it,
and that there is a partial form (_form.haml) that both the edit.haml
and