Displaying 20 results from an estimated 6000 matches similar to: "Routing error with nested resources"
2007 Sep 21
1
generating nested resource path
I have a nested resourced called attachments:
(routes.rb)
map.resources :content_campaigns do |content_campaigns|
content_campaigns.resources :attachments, :member => { :download
=> :get}
end
But, I can''t seem to generate the new path after I create a new
attachment:
(attachments_controller.rb)
format.xml { head :created, :location =>
attachment_url(@attachment) }
2007 Oct 01
0
View Spec - Misbehaving
I''m trying to write my first view spec; I''ve done some controller specs with
integrated views, but thought that isolating the views for some of these
tests might be nice.
So I wrote this:
> describe PlayerContainer, "show" do
>
> PARENT_ID = 12
> CHILD_NAME = ''Child Name''
> PARENT_NAME = ''Parent Name''
>
>
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
2005 Dec 29
3
Post problem with select lists
hey,
i have this problem
how come i always get -1 for the select list??
rhtml
First, select a client.
<select id="client_id" name="client[id]" onChange="submit();" >
<%= options_for_select(@client_options, @client_id.to_i) %>
</select><%= @client_id %>
controller
if @request.post?
if @request.xml_http_request? #called by ajax,
2006 Apr 19
1
AJAX, Response codes and Opera.
Hello all.
I am in the following situation. I page made up of a few divs and a form
using
form_remote_tag like so:
<%= form_remote_tag :update => { :failure => ''content'', :success =>
''body'' }, :url => { :controller => ''server'', :action => ''create'',
:client_id => params[:client_id] } -%>
<%=
2006 Feb 08
2
compound conditions in find
can''t seem to find the right syntax for this...
/script/../config/../app/controllers/placements_controller.rb:155:
syntax error
:conditions => [["placements.client_id = ?",
params[:client_id] ] and "placements.discharge_date IS NOT NULL" ],
this part works...
:conditions => ["placements.client_id = ?", params[:client_id] ]
this is what I
2007 Oct 25
1
find - group - postgres
I am not sure that this is entirely a rails question as I am trying to
run the command in postgres and I am getting the same error...
controller code...
@client_slot_count = ClientSlotsDaily.find(:all,
:conditions => ["created_at > ? AND created_at < ? AND
facility_id = ? AND client_id IS NOT NULL",
starting_date, ending_date, @facility.id],
2006 Apr 13
1
Adding a title to an AJAX link.
Hello all.
I am trying to add a title to a link_to_remote created AJAX link.
What I want to create is:
<a href="#" title="VALUE-HERE" onclick="new Ajax.Updater(''content'',
''/area/show/28/40'', {asynchronous:true, evalScripts:true}); return
false;">Area Name</a>
However I cannot seem to get it to work, the API says
2008 Sep 03
0
how can i clear the inner resources route in a nested route
I have :
map.resources :users do |users|
user.resources :addressbooks
end
this provide me with url like ''/users/1/addressbooks/1'' and ''/
addressbooks/1''.
My problem is that how i''m able to clear the ''/addressbooks/1'' route
and making it not to work? I only wanna the former to work.
2007 Aug 31
2
How to spec routes for a resource nested in multiples resources?
Hi,
I got the resource "Llamadas" nested in:
- Operadores
- Productos
- Centros
Here is part of my routes http://pastie.caboo.se/92767
I want to spec that the routes for Llamadas, I tried several approachs:
- route_for(:controller => "llamadas", :action => "exitosas",
:operador_id => 1).should == "/operador/1/llamadas;exitosas"
-
2011 Feb 22
1
collapsing by a key in a compound database
Hello all.
I have a problem with collapsing by a key in a compound database. I have
2 databases (e.g. clients and client branches), both of them have the
same attribute (with the same valueno), `client_id'.
What I need is to search in both these databases and collapse results by
`client_id' to get client IDs (set_collapse_key is used with
collapse_max=1).
The problem is that I receive 2
2008 Jun 30
0
Nested resources routes
Hi!
I''ve got a quick question in routing.
Is there any difference between
map.resources :stuff, :has_many => :inner_stuff
AND
map.resources :stuff do |stuff|
stuff.resources :inner_stuff
end
?
Both calls seem to do the same thing - they just register the
:inner_stuff as a resource inside :stuff resource (in terms of routes).
Do they?
Thanks
--
Posted via
2012 Jul 15
1
Facebook redirect
Hi everyone
I have this Application witch won''t redirect, I think it''s because there is
another redirect, I mean when i redirect to the FB url
(https://www.facebook.com/dialog/oauth?client_id=439021042804757&redirect_uri=http://localhost:3000/)
I know there is another redirect, but I can''t get rails to follow this
redirect. I had tried to google it, but
I
2008 Jul 11
1
Using custom routes to handle new nested resources
I have a couple of resources, one nested in the other, such that my
resource spec in routes.rb is:
map.resources :parents, :has_many => :children
This will generate a route for a new child that assumes that the parent
has already been saved, something like:
/parents/:parent_id/children/new
But what if I want a route that handles the case where the parent
resource is also new, and thus
2008 Jan 04
2
Nested Routes + Facebook Resources
Does anyone have nested routes working with the facebook_resources
method?
My routes.rb has:
map.facebook_resources :users do |users|
users.facebook_resources :images
users.facebook_resources :connections
end
but user_connections_url won''t generate.
"rake routes" gives me:
new_user POST /users/new
{:action=>"new",
2006 Feb 10
2
How do I test actionview helpers in the console?
I would like to see the output of actionview helper methods, to be able
to play with it.
When I do the following in the console:
collection_select("job", "client_id" , @clients, "id", "name")
I get:
NoMethodError: undefined method `collection_select'' for
#<Object:0xb7cf1970>
I''d like to get something like:
<select
2006 Jul 16
4
Calculations across multiple tables
I have a time tracking app where (pseudo-code)
Client has_many Task has_many TimeRecord
TimeRecord
start_at, :datetime
end_at, :datetime
What I''m trying to do (and I have done using find_by_sql in the past) is get
a sum of the timespan given by ended_at - begun_at for each client.
Is it naive to imagine that AR''s calculations will span relations to provide
a grouped
2006 Feb 20
2
file_column: changing default store_dir
File_column plugin is great. I need to change the default :store_dir
from the dynamic "model_name/attribute_name" to an equally dynamic
"client_id/app_id/model_name/attribute_name". In my model I have:
class Component < ActiveRecord::Base
belongs_to :component_type
belongs_to :component_group
breakpoint
file_column :content,
:magick => { :versions
2006 Jul 08
4
Hidden fields in forms
Please can someone show me the correct syntax for a hidden field in
forms, this is my code
<%= start_form_tag :action => ''create'' %>
<div class="form1">
<table width="auto" boader="8" cellspacing="5" cellpadding="5">
<% hidden_field ''line_item'', ''client_id'', :value
2006 Mar 21
3
Newbie - ActiveRecord relationships
So I''ve worked through Agile Web Development with Rails and I''m now
trying my first little app to get into the swing of things. Its a task
tracking app where people can create tasks and assign them to others,
and also log time against the tasks.
I''m having trouble working out the model relationships. This is what
I''ve got so far, but its not right as