similar to: making has_and_belongs_to_many save more elegant

Displaying 20 results from an estimated 500 matches similar to: "making has_and_belongs_to_many save more elegant"

2006 Feb 13
2
Overriding the error_messages_for method
If I wanted to override the error_messages_for method where within the rails structure would I put it? Which file? Thanks :-) John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering information on the net http://cusec.soen.info - software engineering conference
2006 Feb 13
3
Getting Rid of Error Divs around fields that have errors
Is there a way to get rid of the divs around an error field. These divs are causing me headaches. Any suggestions :-)? John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering information on the net http://cusec.soen.info - software engineering conference
2006 Jun 09
2
Creating An Extra Association Between Two Tables
Good Friday Everyone :-). These are my models: Problem -> has_and_belongs_to_many :tags Tag -> has_and_belongs_to_many :problems Now if a tag does not exist and I create it and associate it to the problem it works self.tags << Tag.create(:name => tag) But if I have the tag already in the DB and just want to link it to another problem it does not really like me. I do it
2006 Feb 12
2
Using Random Longer Non-Sequential IDs
Instead of using sequential integers for IDs for my objects I was wondering if I could easily make it so that my IDs where longer auto- generated random strings/integers. So instead of: http://www.mydomain.com/user/view/1 Would be: http://www.mydomain.com/user/view/d81096b87a7c5565f On top of that... is there big benefits for security reasons to use non-sequential numbers? Is it worth
2006 Feb 14
1
Additional Model Validation
I created a method to do additional validation on my model. How can I have that run whenever a model is being saved? (For now I don''t want to extend AR.) John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering information on the net http://cusec.soen.info -
2006 Feb 15
2
Ruby 1.8.2 work with Edge Rails
Does ruby 1.8.2 of ruby work with edge rails or do I need to upgrade? John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering information on the net http://cusec.soen.info - software engineering conference
2006 Feb 17
2
acts_as_versioned and acts_as_taggable on same model?
I am trying to use acts_as_versioned and acts_as_taggable (plugin) on the exact same model. Has anyone successfuly done this? I think what I need to do is make model_versions acts_as_taggable instead of my main model. Anyone have any other suggestions or any suggestions how to do this? Your Friend, John Kopanas http://www.kopanas.com
2006 Feb 11
2
Migrations and Unintialized Constants Error
I am running into a problem with two of my tables and the "uninitialized constant" error when using migration. I get the "uninitialized constant Note" when running the following code in my migration file: create_table :notes do |t| t.column :id, :integer t.column :noteshare_id, :integer t.column :title, :string t.column :covered, :string
2006 Feb 12
5
Passing Multiple Values In URL
Been a while since I programmed in Ruby and Rails and some of the basic concepts I just loose so quickly. This one I can''t find any examples of. I want to pass two pieces of information in my URL. The :id plus I want to pass my user_id. How do I pass it using the link_to? Stupid question I know... but I can''t find the answer. John Kopanas http://www.kopanas.com
2006 Feb 11
1
Singularize and Pluralize of the word Faculty
I am have problems with one of my model''s call Faculty... my models name is Faculty so the database should be called faculties right? Has there been documented problems with words ending in ''y''? Thanks for your help. John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the
2006 Feb 14
0
Edge Rails and Not Working So Consistently
I just started using edge rails and I wanted to know if it was just me or others are having the same problem. With edge rails I am getting a lot of uninitialized constat [Model Name] -> where Model Name changes depending on which model I am accessing. If I hit refresh it sometimes works but not often. Do I have to make a change when I use edge rails? John Kopanas
2006 Feb 17
1
acts_as_taggable plugin and multi word tags
I decided to play with the plugin acts_as_taggable based on Chad Fowler''s book Rails Recipes. Is it just me or can tags only be one word? If not can you explain to me how to assign multi-word tags using the acts_as_taggable plugin. Thanks :-) John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source
2006 Feb 14
6
Creating a String of Random Characters and Numbers
I want to create a random string of length n that is made up of characters and integers. Is there a function in rails or ruby that allows me to do this? Thank you my friend :-). John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering information on the net
2006 Feb 15
8
[OT] I user CocoaMySQL... anyone have any other preferences for MacOS X?
Looking for a quality alternative... if there is one :-). John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering information on the net http://cusec.soen.info - software engineering conference
2006 Feb 14
8
Best Practices For back/cancel/return button
Are there any best practices for implementing a back/cancel/return button... even when the page you want to return people too is 2 pages back (when people submit form and then want to return)? Thanks :-) Your Friend, John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering
2006 Jun 09
1
Updating Fields In Migration for HABTM Relationship
Earlier I forgot to add updated_at and created_at columns for my HABTM relationship so I created a migration to add them. In the migration I also want to go back and set the value of the created_at and updated_at columns for the previous rows. What is the best way to do that? Initially I thought I was being smart and decided to put an UPDATE SQL query in a find_by_sql statement and
2006 Jun 10
1
Validating Object Without Saving It
Is their a way to validate an object without saving it? So I can do something like this if user.save else end But where save is just validating it but not actually saving it into DB. I just don''t want to save the object yet. Thanks guys and gals :-) John Kopanas http://www.kopanas.com ============================================================ http://www.soen.info - Index of
2006 May 26
2
link_to and fragment identifiers
Fragment identifiers, it took me 30 minutes just to figure out what they are called. I would like to be able to create url that looks like this: post/view/id#comments How do I do that with a link_to function? link_to "Comments", :controller => "post", :action => "view", :id => post.id ??? Thanks guys! :-) John Kopanas http://www.kopanas.com
2006 May 23
2
HABTM for Dummies Question
Taking time off from programming is always painful :-). I have the following Models: ==== class Tag < ActiveRecord::Base has_and_belongs_to_many :problems end class Problem < ActiveRecord::Base belongs_to :user has_and_belongs_to_many :tags end ==== And the following migrations: ==== create_table "problems" do |t| t.column "user_id", :integer
2006 Jun 10
3
Weird Problem With Active Record
Is it me or is my model getting the created_at from the wrong model! I have a HABTM relationship between Problems and Tags. In one of my controller I do the following: def view @tag = Tag.find_by_name @params[:id] end In my view I do this: <% @tag.problems.each do |problem| %> ... <%= problem.created_at %> ... <% end %> Now, how come the created_at