Displaying 8 results from an estimated 8 matches for "movie_id".
2006 Aug 16
3
Question RE Rails associations
...d_belongs_to_many :studios
has_and_belongs_to_many :movies
end
The underlying database structure is as follows:
studios
id: integer
movies
id: integer
studio_id: integer
actors
id: integer
actors_studios
actor_id: integer
studio_id: integer
actors_movies
actor_id: integer
movie_id: integer
(Note that in this case I am not using a movies_studios table)
The question I want to answer is, given an actor_id and studio_id, how
do I find all related movies? Or, stated differently, how do I find all
movies for a given studio/actor combination?
I have come up with several possi...
2008 Jan 23
2
CSRF / cached authenticity tokens / ajax requests
...here and say the new CSRF protection in
Rails is flawed. Why? Forget about caching if you care to use it.
Consider the following:
<% cache do %>
<%= link_to_remote "Add To Favorites", :url => {:controller =>
"favorites", :action => "create", "movie_id" => 2} %>
<% end %>
# Output
<a onclick="new Ajax.Request(''/favorites?movie_id=2'',
{asynchronous:true, evalScripts:true, method:''post'',
parameters:''authenticity_token='' +
encodeURIComponent(''a85178cac134447c87a...
2008 Mar 29
3
primary key?
can you use 2 pirmary keys.
the standard user_id key exists but i would also like to use another
key for my links. i am not sure how to implement this. also i don''t
want any auto incrementing of this second primary key that i would
like to use for my relationships.
if there is a good db, model, relationship tutorial out there i would
love to know about it.
2006 Jan 21
7
n-way joins
Hi,
I''m somewhat of a Rails newbie and am trying to understand how to
formulate n-way (3 or 4 way) joins in Rails (where the join tables
contain extra data as well.)
Let me give you my basic entities:
foos
id - pk
name - unique
bars
id - pk
name - unique
bazs
id - pk
name - unique
frozs
id - pk
name - unique
then i have two separate join tables:
foos_bars_bazs - 3 way join
2006 Dec 13
6
triggering a query within a loop
Any help with this would be very appreciated, I''m completely new to
rails. I''m building an application that''s looking to do the following:
First off i''m trying to convert my site from ColdFusion to RoR, this is
the site: http://www.walkenclips.com/
It''s one page that basically does this:
Query the db to get a list of movies (movies table)
Loop
2006 Aug 17
1
More on n-way.
...I can have an *Actor*,
that is ALSO a *Director* or a *Writer too.
If I update some Actor information, I have to update it on the other
tables (Directors,Writers), if it''s there.
Solution ?
Using database, I solve like this.
@person
id
name
birth
...
@type
id
name
@movies_people_types
movie_id
person_id
type_id
In this way, I can have the same person working on a movie as a
Director AND as an Actor,
and I just update information in one place, the Person model.
How to put this on Rails ? If theres another way to get in the same
result, I`d appreciate suggetsiont.
PS. Sorry my English,...
2006 Jul 06
0
Paging with multiple tables/models
...ng over the combination.
I''ve played with having a seperate object that combines the two (and
is paginated), having one of my two objects select and join/union, but
neither seems completely bug free and clean.
Any ideas?
Thanks.
- Jim
If it helps...
movie_borrower columns: id, user_id, movie_id
book_borrower columns: id, user_id, book_id
2006 Jun 09
0
has_many / : through / check_box - update problems
...ble
While in a Movies controller, I want to loop through each Territory and
display a line which allows editing of the localdetails for that Movie
for each Territory, something like...
for territory in @territories
localdetail=LocalDetail.find(:all, :conditions[''territory_id=? AND
movie_id=?'',territory.id,@movie.id])
check_box(''movie[localdetail_id][]'',''will_be_shown_here'')
end
But I can''t find any form of syntax for the checkbox that will allow
this to work.
I think I''ve tried everything, but of course, you may k...