hi,
maybe the rails pros here can help me with the software design of a contact management web app.
i want to create Groups, where I can add Contacts to. I thought I generate a Group scaffold and a Contact scaffold with
group:references
Then I the models to
Group: has_many :contacts
Contact: belongs_to :group
I also set the rou...
Hi,
browsing rails source, I found in railties/lib/initializers.rb such method
def env
@_env ||= begin
require 'active_support/string_inquirer'
ActiveSupport::StringInquirer.new(RAILS_ENV)
end
end
I know how it works, but why it is implementing this way? Only for lazy loading, or maybe there are other reasons?
...
I have two applications that need to talk to each other over HTTP. One is a PHP app and the other is my main app, the Rails app. I am needing the PHP app to talk to the Rails app by POSTing data to it, but when I do, I receive the Invalid Authenticity Token error. Is there anyway around this? Or how would I just create my own token to pa...
Hello.
Just wondering if anybody had the same problem with rubygems.org
I appluad the decision to consolidated everything on rubygems.org, but when the default was rubyforge - I never had any problems. Now it seems I have a problem updating gems everytime I do a new installation. I mean I can work around it, but downloading gems throug...
Hi, I have the following code. This code executes the same sql query twice. Because images is an associated table of properties.
Is there a way to do only one query, but still have the same result?
(@property.images.first ? @property.images.first.url : "/img/nophoto.jpg")
Extra clarification:
the solution should work in 2 scenario's...
I have a "cart" model, a users cart id is stored in their session.
My routes look like this
map.resources :carts
map.cart "cart", :controller => "carts", :action => "show"
in my show view, i displayed the contents of the cart, and everything was fine.
Then i decided i wanted the user to be able to update the quantity of items from th...
Hi,
I am using active scaffold to list my users. The users has many published posts and unpublished posts. I need two links in my users active scaffold table "Published posts" and "unpublished posts". When clicked on Published posts, it should display all the published posts fields under the user record and the same for un published po...
Good morning all,
I'm trying to get Dan Mange's query_stats plugin up and running in my rails app, so I can get a clearer look at the number of queries I'm running.
I've installed the plugin:
script/plugin install http://github.com/dan-manges/query_stats.git
And added the following code (per the rDoc) to my view:
Queries in Control...
I have the RedCloth gem in my vendor/gems directory.
I also have this in my environment.rb:
config.gem 'RedCloth'
So why does Rails complain that the gem is missing:
Missing these required gems:
RedCloth
What else does it need to recognize that I have it installed in the vendor/gems directory?
environment.rb:
RAILS_GEM_VERSION ...
I've placed the file rack_app.rb with simple Rack application in the lib directory:
class RackApp
def call env
[200, {}, 'Hello']
end
end
Then I've added this route:
match 'rack' => RackApp
And when I try to launch the rails server I get the following error:
config/routes.rb:65: uninitialized constant RackApp (NameError)
...
Curious if anyone has seen any good references for using the new ActionMailer outside the rails framework. Thanks.
...
I have a special case Model which must not become part of an outer transaction:
Outer.Transaction do
...
Inner.create(:blah)
...
end
How do I stop Inner becoming part of the transaction, assuming Inner should know nothing about which specific transaction it is getting pulled into?
For example, creating an inner transaction is...
I am using ruby on rails 2.3.9. The rake db:migrate passed successfully. However when I run rake db:migrate:redo to test the down part I get error message. I am using mysql with Innodb.
class AddConstraints < ActiveRecord::Migration
def self.up
ActiveRecord::Base.connection.execute <<-EOS
ALTER TABLE venues
ADD CONSTRA...
When internationalizing a rails app, what is the best practice way for organizing/scoping translations in the dictionary files?
Under what circumstance should you use interpolations of variables?
Should every phrase be it's entry?
Is there anyone who participated in dhh's tolk who can shed some light on how 37signals broke up their d...
I am using the auto complete plugin by Devbridge and I have it all installed here is my code:
$(document).ready(function(){
$('#request_task').autocomplete({
serviceUrl: '<%= ajax_path %>',
minChars:1,
width: 300,
delimiter: /(,|;)\s*/,
deferRequestBy: 0, //miliseconds
params: { artists: 'Yes' },
...
Hi,
I am working on an app that uses the W3C standard geolocation API but I cannot for the life of me get it to work on Safari on my Windows 7 and XP PC. It works fine on my iPad and my iPhone. It also works perfect on Chrome (5, 6, 7 and the Canary build) and on Firefox (3.6). I don't have a Mac so I can't test it on that. IE doesn...
How do I get Rails to load my lib folder during tests?? Rails 2.3.8. I have this:
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require "ruby-debug"
gem 'test-unit'
require "test/unit"
require 'active_support'
require 'active_support/test_case'
require 'active_record'
require 'a...
Using this itunes search gem, and the documentation seems really straightforward. It fails
with
NameError: uninitialized constant Itunes
gem install itunes-search
Usage
base = Itunes::Base.new
search_object = base.search("term"=>"The Killers")
# get an array of the search_objects
results = search_object.results
results.each ...
I've hit a stumbling block and I'm not sure how to proceed. I'm trying to get resque working with redis to go on heroku, I have it all working locally, but when I push to my staging environment and try to queue a job I get the following exception:
TypeError: wrong argument type JSON::Pure::Generator::State (expected Data)
On my local m...
I have a module which is used in several controllers and is stored in app/controllers/. I want to create a spec for it in spec/controllers. The spec will be testing the module's functions, not an actual controller class.
But, all specs in spec/controllers get the ControllerExampleGroup behaviors. And once that example is mixed in a con...