Displaying 20 results from an estimated 3000 matches similar to: "Capistrano, Media Temple and their Grid Servers"
2006 Nov 02
4
Still Having Problems With :through When Going To Same Table... Help... please :-(
I am having a problem with doing a :through that goes back to the same table.
The following are my two classes:
>>>>>
class User < ActiveRecord::Base
has_many :spanks
has_many :spanked, :through => :spanks, :source => :spanked_user
has_many :was_spanked_by, :through => :spanks, :source => :user
end
class Spank < ActiveRecord::Base
belongs_to :spanker,
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 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 Mar 20
2
Capistrano, ftp user and svn user are different
What do you do when the ftp login username is different then the svn
username?
Every time I try to deploy it gets stuck right here:
[kopanas.com] executing command
** [out :: kopanas.com] Authentication realm: <http://kopanas.com:80>
kopanas.com
** [out :: kopanas.com] Password for ''jkopanas'':
** [out :: kopanas.com] subversion is asking for a password
** [out ::
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 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 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 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
2008 Dec 05
1
Question About Rails.cache and find method.
The DB load on my site is getting really high so it is time for me to
cache common queries that are being called 1000s of times an hour
where the results are not changing.
So for instance on my city model I do the following:
def self.fetch(id)
Rails.cache.fetch("city_#{id}") { City.find(id) }
end
def after_save; Rails.cache.delete("city_#{self.id}"); end;
def
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 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
2005 Dec 28
1
making has_and_belongs_to_many save more elegant
When a user creates a post I also want to save all the tags
associated with it. I do that in the post_controller like this
presently:
def save
@post = Post.new(@params[:post])
@tags = Tag.new(@params[:tags])
@post.user_id = session[:id]
if @post.save
@tags.title.split('','').each do |tag|
present_tag = Tag.find_by_title(tag.strip)
present_tag =
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 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 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 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
2008 Nov 19
3
Rails.cache and problem with model id?
I have the following:
MODEL:
def self.get_tag_cloud
Rails.cache.fetch(''fetish_tag_cloud'', :expires_in => 1.hour) do
find(:all, :conditions => [ "approved_for_tag_cloud = true"], :order
=> "LTRIM(name)")
end
end
CONTROLLER:
def index
@fetishes = Fetish.get_tag_cloud
end
VIEW:
....
<% @fetishes.each do |fetish| -%>
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