Displaying 11 results from an estimated 11 matches similar to: "Join table with attributes"
2006 Feb 19
4
Multiple HABTM to one table
I have a class Player, and a class Game.
Game has two HABTM relationships to the Player table through seperate
relationship tables.
class Game < ActiveRecord::Base
has_and_belongs_to_many :players, :uniq => true
has_and_belongs_to_many :victors, :class_name => ''Player'', :uniq => true
end
When I add Player A to players, and Player B to victors, and save the
2011 May 19
1
update_attributes updates data from second instance of nested form but not the first
Got a weird situation with an update put to a controller with a form with
nested attributes.
On the data below, I am updating data for both items (''0'' and ''1'') in
rosters_attributes (in the example below I am updating the ''name'' attribute
to a new value in both cases. What I am stuck on is that ''1'' gets its data
updated,
2006 Mar 16
3
inserted_at seems buggy in production mode?
Hi,
I''ve got a table with an inserted_at column. When I insert a record it
automatically injects the current date/time, all is well.
Then when I insert a second record, it uses the exact same timestamp
that is used in the first record.
This behavior only seems to occur in production mode. When I restart the
server, the problem goes away but then immidetatly occurs again on the
2011 May 17
0
Select not maintaining state on nested form with
I am using nested forms with multiple instances of various of the forms. The
problem I cant figure out is how to maintain state for the select between
postbacks. I am using ''options_from_collection_for_select'' and in this the
last param is to be the selected value, but given the dynamic nature, the
value is going to depend on the iteration of the form builder. If I manually
force
2013 Oct 02
2
Rails 4 ujs button only works after second click
Here''s the code
https://gist.github.com/dasibre/6786245
*new.js.erb file has the following js code*
$(''a.pinbutton'').on(''click'', function() {
$(this).parent().append(''<%= escape_javascript(render("select")) %>'')
});
*here''s the player index with the new link*
<%= link_to "Pin",
2006 Apr 23
0
Severe STI, HABTM with Attributes and 1.1
All,
I had been working on a project that was using STI to a very high
degree. It also was using a HABTM table that had a couple extra
attributes. It seems that with 1.1 push_with_attributes is deprecated
and I am having a bit of trouble moving things to using has_many
:through
The original schema I had worked like this :
create_table "nodes" do |t|
t.column "title",
2010 Jun 10
9
Rails3 beta4 + Ruby 1.9
When I try rails console using Rails3 beta4 and Ruby 1.9.1-p378 I
cannot save a record:
> rails console
Loading development environment (Rails 3.0.0.beta4)
ruby-1.9.1-p378 > g = Game.new
=> #<Game id: nil, player_id: nil, versus_id: nil, finished: nil,
created_at: nil, updated_at: nil>
ruby-1.9.1-p378 > g.save
NameError: undefined method `<=>'' for class
2007 Apr 07
3
Fully virtualized w/ postfix?
Hi folks,
I've poked through the archives and google and have not seen how do do this.
Is it possible to virtualize ALL emails on a system? That is, I want
delivery only to e.g. /var/mail/vmail/domain.tld/user/Maildir/, and for
authentication & userdb to:
1) Try /etc/passwd, and if someone is there, automatically append the
"default" domain, otherwise,
2) Authenticate off a
2006 Apr 07
5
Confusion about has_many / belongs_to ...
I have a table called players and its model Player, and I have a table
called games and its model Game.
In the games table I have:
player1_id int(11)
player2_id int(11)
I want the tables to be associated so that I can access the player
objects using table.player1 and table.player2 rather than having to
lookup the objects based on the ids.
I am not sure how to go about this but I suspect I
2006 Sep 19
1
No request.raw_post when using RJS template?
Hi all
I wanted to try out the RJS thing for updating more than just one HTML
element using AJAX.
I have a selection like that:
<select id="booking_musician_profile_id"
name="booking[musician_profile_id]">
<option value="4" selected="selected">Danc!ng TortoYse</option>
<option value="2">DJ Psyhigh</option>
2006 Feb 28
0
acts_as_taggable in Rails 1.1 question
I''ve been using the acts_as_taggable gem in 1.0 to develop some tagging
functionality. The issue is that I need to specify tags by user (i.e.
update additional attributes in the join table). So, in my join table I
have a "user_id" field. I''ve read about the "push_attribute" method in
the api, but that doesn''t seem to work with the gem (and