In almost every environment.rb, there's a line for config.time_zone = 'UTC'.
What exactly does this line do, and under what circumstances would I want to change it (to, e.g., config.time_zone = 'EST')?
...
Hey guys, first post here, hope you can help me out.
We're generating a newsletter automatically every 24 hours using a rake task. There's a section at the top of the newsletter where an admin can put a customized message. The screen that the admin uses has a live preview of the newsletter (they were insistent on this), rendered using...
We are currently using an outdated screen scraper gem to import contacts from gmail/yahoo/etc. I want to update this to use the new OAuth based APIs so users don't have to enter their credentials on our site. I'm really intrigued by the work Plaxo is doing with Portable Contacts which Google also supports. It feels like that is a good...
Warning, I am new to ruby on rails. I know my database isn't setup all that great, but we're pulling in from a remote database and storing information from that database.
Users:
- id
- ...
stations
- id
- user_id
- hex_key (unique)
- ...
calls
- id
- reported by (hex key from stations)
- data source id (from remote databas...
I have a model Foo with attributes id, name, location.
I have an instance of Foo:
f1 = Foo.new
f1.name = "Bar"
f1.location = "Foo York"
f1.save
I would like to copy f1 and from that copy, create another instance of the Foo model, but I don't want f1.id to carry over to f2.id (I don't want to explicitly assign that, I want the db to ha...
I know this is going against ruby on rails conventions, but my id of this table doesn't need to auto-increment and I'm setting it through the logic. However, it's not saving to the database. Everything getting saved is saving as null for the id.
def self.up
create_table :probes, :id => false do |t|
t.string :id
t.string :name
t.i...
I am implementing some ruby on rails code tweet stuff for my users. I am creating the proper oauth link...something like
http://twitter.com/oauth/authorize?oauth_token=y2RkuftYAEkbEuIF7zKMuzWN30O2XxM8U9j0egtzKv
But after my test account grants access to twitter, it pulls up a page saying "You've successfully granted access to . Simpl...
So, I'm using Paperclip and AWS-S3, which is awesome. And it works great. Just one problem, though: I need to upload really large files. As in over 50 Megabytes. And so, nginx dies. So apparently Paperclip stores things to disk before going to S3?
I found this really cool article, but it also seems to be going to disk first, and then do...
I have a rails time-based query which has some odd timezone sensitive behaviour, even though as far as I know I'm using UTC. In a nutshell, these queries give different answers:
>> Model.find(:all,:conditions=>['created_at<=?',(Time.now-1.hours).gmtime]).length
=> 279
>> Model.find(:all,:conditions=>['created_at<=?',(Time.now-1.hours)])...
I'm creating a website with rails that sells a virtual service, and therefore don't really want to validate the billing address for credit card transactions.
From what I have read on paypal (page 14 of this pdf) and other resources i have looked at, this should be totally possible. However, when I submit a purchase or an authorize re...
I am playing with making a blog. I would like to have several types of entries (a link to an interesting site + brief comment, a traditional blog post with title and body text, a picture... you get the idea).
The idea seemed straight forward. An entry table/model with a the few details common to all those types (creation time and a litt...
Hi there,
I have a PostsController, not essential to the example but will help when I paste snippets, and I'm using current_page? to, as the name implies, figure out what page is being displayed. I'm getting what seem like weird results.
current_page? will return different answers if I go to /posts vs. /posts/.
As a test, on the index...
Rails, on development mode is SLOW. Very, very slow. I run Vista, and I set config.cache_classes = true in development.rb... But, it's still slow and I have to restart the server after I change my code.
My coworker develops Rails on a Mac and sees similar slowness.
My development time slows down significantly because it takes minutes ...
I'm about to start a fairly large project for a mid-sized business
with a lot of integration with other systems (POS, accounting,
website, inventory, purchasing, etc.) The purpose of the system is to
try to reduce current data siloing and give employees role-based
access to the specific data entry and reports they need, as well as to
rep...
I've recently came across different tutorials, where people use both mock and mock_model functions.
In RSpec tutorial for controllers they use the mock_model function, but right in the documentation of RSpec, there is only mock function, but no mock_model
I tried to run some tests myself, and I didn't find any real difference, since ev...
Is there a way to combine scopes in an additive fashion?
If I have the scopes
User.big_haired
and
User.plays_guitar
I can call
User.big_haired.plays_guitar
and get all the users who have big hair AND play guitar. Can I write this to get all users who have big hair OR play guitar?
I guess I have to add that I realize that you ...
I've successfully made authorized a card, and it shows up in my sandbox transaction log. When I try to capture using that authorization (with activemerchant, which uses SOAP), this is the XML it sends to the server:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w...
Hi all, lets say i have the following relationship:
class Event < ActiveRecord::Base
has_many :tickets
end
class Ticket < ActiveRecord::Base
belongs_to :event
end
And I have a route like this:
map.resources :events, :has_many => :tickets
map.resources :tickets
And i have a before filter like this on tickets_controller:
be...
I am new to Ruby. I am having trouble passing the parameters to a web method.
factory = SOAP::WSDLDriverFactory.new('https://api.affili.net/V2.0/Logon.svc?wsdl')
driver = factory.create_rpc_driver
driver.Logon(...)
How can I pass in the required parameters? I have tried passing in an array, but the paramters are made nil, I tried cre...
I've a running nginx and Ubuntu 8.09 site running a rails app -- but we are not making use of Peassenger anymore and it seems to take up a lot of memory.
I google around and there's tons of info on how to install Passenger, but I didn't find any on uninstalling.
...