It will if there's a :small_projects association on customers (you could make one) (Or, you could make your projects controller know about :type (and override find/new_resource methods), and route :small_projects to :projects, :type => 'small_project')
> - is customer_small_projects_url(resource) the correct notation?
It depends on your routes.rb, This is just rails though, nothing to do with RC, resource is just a method pointing to (in this case) a customer
> How do I use will_paginate with r_c - is it at all possible?
It should be - I have Just change find_resources to something like this:
def find_resources resource_service.paginate(options) end
> ps. is the public lighthouse "draft" still up for grabs ( or will > github suffice?)
Issue tracker (for bugs and patches, use this group for this sort of request) is now at lighthouse
Cheers, Ian -- Argument from Design--We build web applications Western House 239 Western Road Sheffield S10 1LE UK Mobile: +44 (0)797 4678409 | Office: +44 (0)114 2667712 <http://www.ardes.com/> | <http://blog.ardes.com/ian>
sorry - I must have some SPAM filter engaged or-what-not - did not
receive any notification even though I signed up for this list <:)
anyways,
I dug up pagination_find - which somehow seemed to fit the bill - but
now I see your answer, and that will probably lure me into trying out
will_paginate once more :)
I've managed to do the index for /customers/4/small_projects - and
with a one-line patch to pagination_find, I'm able to do nested
pagination like /customers/4/small_projects/5/tasks?page=3
I know this is completely of track but this is what I "patches" into
pagination_find (or rather - the module Helpers) - not pretty and my
ruby illiteracy shines, but it gets me through <:)
def paginating_links(paginator, options = {}, html_options = {})
name = options[:name] || DEFAULT_OPTIONS[:name]
params = (options[:params] || DEFAULT_OPTIONS[:params]).clone
paginating_links_each(paginator, options) do |n|
params[name] = n
# was: link_to(n, params, html_options)
url = resources_url+"?#{name.to_s}="+n.to_s # changed
link_to(n, url, html_options) #
changed
end
end
Thank you so much for answering - and have a good one!
Walther
ps. should you ever find yourself "stranded" in Jutland or Denmark at
all, please give me a call - I would like to help you to a pint or two
of some of our danish brew (read: beer) :)
I don;t really know much about pagination_find, never used it.
the will_paginate answer might help you out though - basically treat resource_service like a class or association
> ps. should you ever find yourself "stranded" in Jutland or Denmark at > all, please give me a call - I would like to help you to a pint or two > of some of our danish brew (read: beer) :)
Will do - always up for a beer
Cheers, Ian
-- Argument from Design--We build web applications Western House 239 Western Road Sheffield S10 1LE UK Mobile: +44 (0)797 4678409 | Office: +44 (0)114 2667712 <http://www.ardes.com/> | <http://blog.ardes.com/ian>
the pagination_find is back on the shelf, and will_paginate churning
away with resource_service. Super!
next item on my todo is creating new projects.
on the SmallProjectsController, I'm able to do
def new
what.ever.needs.done
end
but if I leave out the def on SmallProjectsController, i get the
default action from resources_controller lib - not the action from the
ProjectsController
is that related to r_c - or just standard Rails/Ruby functionality
that you cannot inherit methods?
I've even tried
def new
super
end
on the SmallProjectsController, but that did not change anything <:(
Why not just def the methods on SmallProjectsController? Well, trying
to DRY my code, I'd sure like to keep as much code as possible on the
ProjectsController - with 8-10 ProjectsController subclassed
controllers on the horizon :)
> the pagination_find is back on the shelf, and will_paginate churning > away with resource_service. Super!
> next item on my todo is creating new projects.
> on the SmallProjectsController, I'm able to do
> def new > what.ever.needs.done > end
> but if I leave out the def on SmallProjectsController, i get the > default action from resources_controller lib - not the action from the > ProjectsController
> is that related to r_c - or just standard Rails/Ruby functionality > that you cannot inherit methods?
> I've even tried
> def new > super > end
> on the SmallProjectsController, but that did not change anything <:(
> Why not just def the methods on SmallProjectsController? Well, trying > to DRY my code, I'd sure like to keep as much code as possible on the > ProjectsController - with 8-10 ProjectsController subclassed > controllers on the horizon :)
> Cheers > walt
-- Argument from Design--We build web applications Western House 239 Western Road Sheffield S10 1LE UK Mobile: +44 (0)797 4678409 | Office: +44 (0)114 2667712 <http://www.ardes.com/> | <http://blog.ardes.com/ian>
Well, that's just it - I thought, I'd read your docs carefully
through, and was expecting to get the ProjectsController#new method,
on my SmallProjectsController - but no!
It's probably the famous "comma" glitch that wreaked havoc on the
Apollo 11 ;)
Anyways, I've added my ProjectsController and SmallProjectsController
here - for everyone to "enjoy" (I mean, I'm so newbee on this rails
road) :))
- please correct me on the code in general, if you see "bad patterns"
class ProjectsController < ApplicationController #<
ResourceController::Base #
# perhaps transform_with_xsl needs this one?
require 'xml/xslt'
I forgot to attach the config/routes.rb (clipped to topic at hand)
#map.resources :customers, :has_many =>
[ :projects, :small_projects, :invoices, :contacts]
map.resources :customers do |customer|
customer.resources :projects do |project|
project.resources :tasks do |task|
task.resources :jobs
end
end
customer.resources :small_projects do |small_project|
small_project.resources :tasks do |task|
task.resources :jobs
end
end
customer.resources :invoices do |invoice|
invoice.resources :invoice_items
end
customer.resources :contacts
end
As you might see from the above clipping, I've tried with
the :has_many way (it's Rails 2.0.2 - isn't it?) and with the :do way
(ol'school!?)
> I forgot to attach the config/routes.rb (clipped to topic at hand)
> #map.resources :customers, :has_many => > [ :projects, :small_projects, :invoices, :contacts] > map.resources :customers do |customer| > customer.resources :projects do |project| > project.resources :tasks do |task| > task.resources :jobs > end > end > customer.resources :small_projects do |small_project| > small_project.resources :tasks do |task| > task.resources :jobs > end > end > customer.resources :invoices do |invoice| > invoice.resources :invoice_items > end > customer.resources :contacts > end
> As you might see from the above clipping, I've tried with > the :has_many way (it's Rails 2.0.2 - isn't it?) and with the :do way > (ol'school!?)
> Cheers
> walt
-- Argument from Design--We build web applications Western House 239 Western Road Sheffield S10 1LE UK Mobile: +44 (0)797 4678409 | Office: +44 (0)114 2667712 <http://www.ardes.com/> | <http://blog.ardes.com/ian>
I'm on 2.0.2 - but I've been looking for an opportunity to ask
someone for quite a while what their opinion towards edge is (for
buildings apps meant to be put into production). Do you develop RoR
apps on edge - and deploy them on edge as well?
I installed the r_c on April 30th
BTW: do you know of a rake tast that will show the (git) version of
plugins?
Hope not to have spoiled the entire r_c with my STI'ing ;)
cheers
Walt
ps sorry for not replying faster - I had to dance lancier with my
daughter who will graduate this summer :)
> I'm on 2.0.2 - but I've been looking for an opportunity to ask > someone for quite a while what their opinion towards edge is (for > buildings apps meant to be put into production). Do you develop RoR > apps on edge - and deploy them on edge as well?
> I installed the r_c on April 30th
> BTW: do you know of a rake tast that will show the (git) version of > plugins?
> Hope not to have spoiled the entire r_c with my STI'ing ;)
> cheers > Walt
> ps sorry for not replying faster - I had to dance lancier with my > daughter who will graduate this summer :)
-- Argument from Design--We build web applications Western House 239 Western Road Sheffield S10 1LE UK Mobile: +44 (0)797 4678409 | Office: +44 (0)114 2667712 <http://www.ardes.com/> | <http://blog.ardes.com/ian>