similar to: permalink_fu and classes with different primary_key than id?

Displaying 20 results from an estimated 200 matches similar to: "permalink_fu and classes with different primary_key than id?"

2007 Jul 04
0
How to handle plugin dependency
I am trying to use the permalink_fu plugin together with the acts_as_taggable plugin so my tags will have both a full name (like COM/OLE) and a permalink suitable for use in a url (like com-ole) so I can have urls like /article/list/com-ole. The only snag I have hit is that when I add: has_permalink :name to the Tag class definition I get a "method missing" error. I was able to get
2009 Sep 28
7
Basic Rails problem with has_many nil values and permalinks
Hi, I have a model property with has_many. I find the property and then I need to find the name of the building or the neighborhood that the property belongs to. The property is not always assigned a building or neighborhood. This becomes a problem when createing permalinks with permalink_fu. has_permalink [:neighborhood_name, :building_name, :address] The neighborhood name and building name
2008 Dec 04
1
permalink_fu and Rails 2.2.2
Hi, Since I have updated my Rails gems to 2.2.2, when I create a new entry in DB which has a permalink I get the following error message: uninitialized constant ActiveSupport::Multibyte::Handlers Do you know if permalink_fu is compatible with Rails 2.2.2? Is there an option I have forgotten to pass to make it work correctly? -- Posted via http://www.ruby-forum.com/.
2010 Jan 25
0
has_many, :finder_sql, setting attributes
Hi all, My question is somewhat complicated, but bear with me. My project has a number of models: User, Program, and Team. Users belong to multiple Programs. Programs have multiple teams, but Teams belong to one program. For each Program a User belongs to, he can belong to multiple Teams. (Think of this in an athletic context where users are athletes, programs are universities). So my
2006 Jan 31
1
Updating :has_many - :through related items
Hi, I''ve got my little app working pretty well. I''m using pretty much the model and table layout from my previous thread, as suggested by Bill Katz: <http://www.ruby-forum.com/topic/52506#26260> I have the Create page working and a delete Match page working, which along with the appropriate record in the Matches table, removes the linked items in the competitions table.
2008 Feb 10
4
method from string?
I am sure this is doable but I can''t find a specific example and my brain is frazzled. Basically, I am doing a whole load of in-place editing and need methods to support the updates. Here is what I am doing now: def set_blog_website faq = Faq.find(params[:id]) faq.blog_website = params[:value] faq.save! @faq = faq do_ret end Surely there is a generic way I can
2006 Jul 18
1
Saving an ActiveRecord object
I get this error when I try to save an object that extends of ActiveRecord: NoMethodError in TeamController#add_player You have a nil object when you didn''t expect it! The error occured while evaluating nil.keys .... .... #{RAILS_ROOT}/app/models/player.rb:17:in `create_player'' #{RAILS_ROOT}/app/controllers/team_controller.rb:53:in `add_player'' And my Player model
2006 Apr 03
2
HABTM migrations
Bad rails day for Matt- In a migration, for a habtm: create_table :teams_users do |t| t.column :team_id, :integer t.column :user_id, :integer end Ok, fine. In a controller (well really a migration script): @user.teams << Team.find( 3 ) And the SQL pumped at my server is: INSERT INTO teams_users (`team_id`, `id`, `user_id`) VALUES (3, 3, 34) Which
2008 Sep 22
8
TimeZone daylight savings time problems
Here is the following from my console: >> Time.now => Mon Sep 22 11:33:34 +0200 2008 >> Time.now.utc_offset => 7200 >> TimeZone[Time.now.utc_offset] => #<TimeZone:0x11aea90 @tzinfo=nil, @utc_offset=7200, @name="Athens"> >> Time.now.in_time_zone(TimeZone[Time.now.utc_offset]) => Mon, 22 Sep 2008 12:34:22 EEST +03:00 (I am in Spain - CET - and
2009 Jul 29
5
[newbie] double relationships in database
I have the following tables teams id :string name :string and matches id: home_team :team_id visitor_team :team_id how can I reflect that kind of relationship in a RoR model? thanks and keep up the good work.
2006 Jul 26
8
team captain - habtm w/has_one...
the below... class User < ActiveRecord::Base has_and_belongs_to_many :teams class Team < ActiveRecord::Base has_and_belongs_to_many :users has_one :captain, :class_name => ''User'' produces the error... Mysql::Error: Unknown column ''users.team_id'' in ''where clause'': SELECT * FROM users WHERE (users.team_id = 1) LIMIT 1 i
2009 Jun 25
7
Join Tables
I just have a few questions about join tables. From my understanding the following applies (correct me if I''m wrong): 1.Join tables are always named with the names of the two associated tables, in alphabetical order, separated by an underscore. 2.The foreign key fields are named with the name of the table they are referencing, with _id appended. 3.The foreign key is referencing a
2008 Jan 27
4
(REST) Nested routes
Hello, I''m in troubles with nested routes. I have three models: Team, Tournament and TeamTournaments class Team < ActiveRecord::Base has_many :tournaments, :through => :team_tournaments has_many :team_tournaments class TeamTournament < ActiveRecord::Base belongs_to :team, :foreign_key => ''team_id'' belongs_to :tournament, :class_name =>
2006 Jun 22
4
Filter on variable
Hi all, I have a question about filtering on a variable. If I have the following code in my controller to select a list of users > @allusers = User.find(:all, > :conditions => [''team_id = ?'', @params["id"], > :order => ''created_at'') Is there an easy way to find out all users who
2006 Mar 13
4
Find and eager loading questions
Hi all, I want to see if I''m not missing something with associations and eager loading. (I''m currently using Locomotive on OS X and SQLite3.) I have two simple tables/models, set up properly: teams has_many :matches and matches belongs_to :teams. Matches has a match number and a team_id field (along with several other fields) and teams has a team_number field (again, along with
2008 Oct 10
1
emails from rake not being sent as html
I have an email that is sent from either a rake task or from a user action. When it is sent from the user action it gets delivered as nicely formatted html. When sent from the rake task it is text, with all the html code visible. Is there a setting I am missing? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups
2006 Apr 16
1
Design question: Years/Teams/Students
People, I want to design a historical sports db for my old school. I think at the moment it should be like: A year has many teams A team has many students A student has one lastname, firstname and middlename but a student can also have many teams (eg summer/winter abd over a number of years) . . Is there a problem with this? Doesn''t it just mean that there will be a student table
2009 Jul 16
9
Please help me understand how arrays are translated in rails
I''ve spent hours researching the subject and have tried many test sequences in IRB, and rails console but I''m just having trouble making headway into what is probably a very easy subject. I understand arrays with at least 4 other languages but with Ruby I haven''t found a mental connection with how I can assign variables to arrays.. Take for example: def
2006 Jul 28
2
has_many :through with multiple paths
Hi all. I am currently thinking about how to do the following: I have the following models. Team Person Team has various positions (manager, programmer etc.) I would like each one of those positions to reference one or more Person records. A single Person record could be on 6 different teams at the same time in different roles. the same person could even be on the same team multiple times
2020 Oct 02
3
Lahman Baseball Data Using R DBI Package
I?m trying to pull data from one table (batting) in the Lahman Baseball database. Notice X2B for doubles and X3B for triples ? fourth and fifth from the right. The dbGetQuery function runs fine when I leave there two out but I get error messages (in red) when I include 2B/3B or X2B/X3B. Can anyone give me some direction? Thanks, Philip Heinrich