Displaying 4 results from an estimated 4 matches for "website_id".
2005 Nov 22
3
non model select_tag problem
What am I doing wrong here:
select_tag(''website_ids[]'',
options_from_collection_for_select(Website.find_all, ''id'', ''name'',
params[:website_ids]), {:multiple => true, :size => 5})
It works fine except that it does not display the selected options once
the form is submitted (it submits to the sam...
2012 Mar 13
2
[Arel]Building query, but can't get a proper output
I have the following code:
advertisements_arel = Advertisement.order("advertisements.id
DESC").arel
@advertisements = (params[:website_id].present? ?
advertisements_arel.where(:website_id => params[:website_id]) :
advertisements_arel).to_a
It returns a struct Arel::SelectManager::Row data
But I''d like it to return an array of Advertisement objects (like it
would normally do) so I can iterate over it more easily. Anyone k...
2006 Jan 17
9
using "find" when you have 2 has_many relations
An Account has_many Websites which in turn has_many WebsiteDomains
Now I can of course do this:
@domains = Account.find(1).websites.find(1).website_domains.find(:all)
To get all the domains for Account with id 1 and Website with id 1.
I would like to do something like this though:
@domains =
Account.find(1).websites.find(:all).website_domains.find(:all)
IE, get ALL domains for all websites in
2005 Aug 22
1
XML Builder question (Brain Teaser? or At A Total Loss?)
...mages_with_options
@images = Image.find_by_sql(["select images.*
from images
join categories on
images.category_id = categories.id
join websites on
categories.website_id = websites.id
where websites.id = ?
order by images.position",
@params[:id]])
@options = Option.find_all
render_without_layout
end
The line beginning with @options is just wrong. I''m...