This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Address < ActiveRecord::Base | |
belongs_to :suburb | |
belongs_to :thing, :polymorphic => true | |
end | |
Fields: | |
thing_id | |
thing_type | |
suburb_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Thu Jul 21 22:30:00 +0930 2005](~rsl@c-24-98-180-17.hsd1.ga.comcast.net) joined #rubyonrails. | |
[Thu Jul 21 22:31:00 +0930 2005]Howdy! Does anyone know if HtmlEngine is a gem or not? | |
[Thu Jul 21 22:39:00 +0930 2005]aqua: yes I searched, but login_generator installs [in an app] as "login_system" so I wasn't sure if it just had another name or was custom code in Typo. | |
[Thu Jul 21 22:40:00 +0930 2005]I'm going to assume it's not a gem. | |
[Thu Jul 21 22:43:00 +0930 2005]Thanks! | |
[Thu Jul 21 22:43:00 +0930 2005](~rsl@c-24-98-180-17.hsd1.ga.comcast.net) left #rubyonrails. | |
[Mon Aug 08 11:28:00 +0930 2005](N=rsl@c-24-98-180-17.hsd1.ga.comcast.net) joined #rubyonrails. | |
[Mon Aug 08 11:28:00 +0930 2005]Morning, everybody! | |
[Mon Aug 08 11:29:00 +0930 2005]Does anyone know how to save information to a text file using RoR? | |
[Mon Aug 08 11:30:00 +0930 2005]I had a feeling it was in Ruby itself rather than rails. Which would be why all my googling added up to nada. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fri Jun 03 15:32:00 +0930 2005] <jellybob> (~jellybob@myfanwy.internal.instance-design.co.uk) joined #rubyonrails. | |
[Fri Jun 03 15:33:00 +0930 2005] <jellybob> Casey: I was hoping there'd be some Rails Day folks around | |
[Fri Jun 03 15:33:00 +0930 2005] <jellybob> Which EST is being used? According to what I can find EST should be UTC-5 | |
[Fri Jun 03 15:36:00 +0930 2005] <jellybob> I thought it was starting an hour ago :\ | |
[Fri Jun 03 15:39:00 +0930 2005] <jellybob> Could you do this the easy way, and just put a countdown in hours on the site? | |
[Fri Jun 03 15:43:00 +0930 2005] <jellybob> I've just realised I'm starting at 4am | |
[Fri Jun 03 16:06:00 +0930 2005] <jellybob> Georaphy: that would depend what you're doing :P | |
[Fri Jun 03 16:16:00 +0930 2005] <jellybob> Casey: What the current time at UTC-5? I'm having trouble getting clocks sorted here | |
[Fri Jun 03 16:17:00 +0930 2005] <jellybob> Thanks :) | |
[Fri Jun 03 16:19:00 +0930 2005] <jellybob> binary42: UTC is exactly GMT - during summer we move to BS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Thu Oct 13 12:05:00 +0930 2005] <Pratik> (n=chatzill@202.65.150.33) joined #rubyonrails. | |
[Thu Oct 13 12:05:00 +0930 2005] <Pratik> Hi room | |
[Thu Oct 13 12:05:00 +0930 2005] <Pratik> I need some help in setting up ActionMailer | |
[Thu Oct 13 12:06:00 +0930 2005] <Pratik> My host is running cpanel | |
[Thu Oct 13 12:06:00 +0930 2005] <Pratik> Any suggestions ? | |
[Thu Oct 13 12:08:00 +0930 2005] <Pratik> concept : I can host you on my server for free | |
[Thu Oct 13 12:08:00 +0930 2005] <Pratik> I am running http://typo.in Posted free hosting offer there | |
[Thu Oct 13 12:10:00 +0930 2005] <Pratik> On the right sidebar | |
[Thu Oct 13 12:10:00 +0930 2005] <Pratik> http://typo.in/articles/2005/08/10/free-ruby-on-rails-typo-hosting | |
[Thu Oct 13 12:14:00 +0930 2005] <Pratik> Read error: 113 (No route to host) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Game < ActiveRecord::Base | |
belongs_to :team_1, :class_name => "Team" | |
belongs_to :team_2, :class_name => "Team" | |
def name | |
[team_1, team_2].map { |team| team.city + ' ' + team.name }.join(' vs. ') | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SubscriptionConfirm < ActiveRecord::Base | |
@@confirm_sent = Hash.new | |
def initialize(params = nil) | |
super(params) | |
set_default_values | |
end | |
def self.subscribe_to_newsletter(params = nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :missing_translations => :environment do | |
@missing_translation_count = 0 | |
for locale in I18n.load_path | |
look_for_candidates(File.basename(locale,".*")) | |
end | |
puts "Total missing translations: #{@missing_translation_count}" | |
end | |
def look_for_candidates(locale, dir="#{RAILS_ROOT}/app") | |
entries = Dir.entries(dir) - [".", "..", ".svn", ".git"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :missing_translations => :environment do | |
@missing_translation_count = 0 | |
for locale in I18n.load_path | |
look_for_candidates(File.basename(locale,".*")) | |
look_for_candidates(File.basename(locale,".*"), "#{RAILS_ROOT}/lib") | |
end | |
puts "Total missing translations: #{@missing_translation_count}" | |
end | |
def look_for_candidates(locale, dir="#{RAILS_ROOT}/app") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fastercsv' | |
class ActiveRecord::Base | |
def self.to_csv(objects, skip_attributes=[]) | |
FasterCSV.generate do |csv| | |
csv << attribute_names - skip_attributes | |
objects.each do |object| | |
csv << (attribute_names - skip_attributes).map { |a| "'#{object.attributes[a]}'" }.join(", ") | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc 'Create YAML test fixtures from data in the existing database.' | |
task(:extract_fixtures => :environment) do | |
sql = "SELECT * FROM %s ORDER BY desc(id) LIMIT 10" | |
skip_tables = ["schema_info", "badges", "badge_groups", "html_links", "hero_plus_status_updates"] | |
(ActiveRecord::Base.connection.tables - skip_tables).each do |table_name| | |
i = "000" | |
File.open("#{RAILS_ROOT}/test/fixtures/#{table_name}.yml", 'w') do |file| | |
data = ActiveRecord::Base.connection.select_all(sql % table_name) | |
file.write data.inject({}) { |hash, record| |