Before all, this question is about Rails 2.x.
I live in a spanish language country and the URLs for my web apps should be in spanish. I always created spanish spelled actions for my controllers until now, but that just turn off many of the advantages for using REST, like the built-in PUT method => edit action stuff.
So, I wanna know ho...
So I have a Git project, and we (a mostly typical Rails project) have a pretty deep directory structure.
When I do git merge I see results like:
app/views/shared/exception_report.erb | 6 +
app/views/ui/sample.html.erb | 11 +-
app/views/verifications/new.html.erb | 10 +-
config/de...
Hi folks, i am displaying remote images on my service
<img src="http://remote-site.com/imageX">
However, sometimes the image is already gone, so I would get 404s or just a plain text.
Question is -> how can i degrade to a generic image as soon as I get something that is not image type?
Actual code, whether in jQuery, Ruby, etc mu...
I am attempting to deploy a Rails application (which works fine in development) onto a production server. I have installed and configured Apache, Passenger, and the necessary gems. After I restart apache and navigate to the server, I get the following error:
Exception PhusionPassenger::UnknownError in PhusionPassenger::Railz::Applicatio...
Could you tell me whats the best practice for storing constants with internationalization in rails3?
f.e. i want to have a constant-hash for haircolours for my user model:
# btw: how can I store such hashes in the locales.yml-files?
# en.yml
HAIR_COLOURS = { "brown" => 0, "white" => 1, "red" => 2, "dark-brown" => 3...}
# de.yml
HAIR_C...
On http://github.com/collectiveidea/delayed_job
it says:
To install as a gem, add the following to config/environment.rb:
config.gem 'delayed_job'
Run rake gems:install
versus
To install as a plugin:
script/plugin install git://github.com/collectiveidea/delayed_job.git
What is the difference between installing i...
I've been writing tests for a while now and I'm starting to get the hang of things. But I've got some questions concerning how much test coverage is really necessary. The consensus seems pretty clear: more coverage is always better. But, from a beginner's perspective at least, I wonder if this is really true.
Take this totally vanilla c...
Such as for delayed_job, there is tobi's version and collectiveidea's version.
http://github.com/tobi/delayed_job
http://github.com/collectiveidea/delayed_job
Who decides what goes into gem install delayed_job? (Does rubygems.org's contain all the official ones?) And if we use anything directly from GitHub, how do we decide w...
Want to build a web app using SOLR as the only backend. Most of the data will be stored in SOLR via offline jobs although there is some need for CRUD.
Looking at popular web frameworks today like Rails, Django, web2py etc. despite NoSQL the sweet spot for productivity still seems to be around active record implementations sitting on top...
I'm using Rails 2.3.8 with Ruby 1.9.1 and I'm having a problem with
serialized attributes in active record not preserving string encodings.
The underlying problem is probably yaml, but I'm wondering if anyone has
any good ideas on how to handle this. The app I'm working on has
numerous serialized fields some of which contain deep struct...
Hi,
I have the following route defined in routes.rb:
map.search 'fuzzyleads/search/:url', :controller => 'fuzzyleads', :action => 'search', :method => 'get'
The problem is that I cannot get this test to pass:
def test_search_route
assert_generates "fuzzyleads/search/someurl", { :controller => "fuzzyleads", :action => "search", :ur...
In Rails 3 I use the following helper in order to get a even-odd-coloured table:
def bicolor_table(collection, classes = [], &block)
string = ""
even = 0
for item in collection
string << content_tag(:tr, :class => (((even % 2 == 0) ? "even " : "odd ") + classes.join(" "))) do
yield(item)
end
even = 1 - even
e...
So within rails, using active record, we can have multiple models that inherit user
Base Class - User
Sub-Class - Employee, Manager, Supervisor
So in rails we use only one table though when you create a new Employee and when you try to access Employee.salary, though only managers and supervisors should have access to those attributes. ...
For http://github.com/collectiveidea/delayed_job
Let's say I just start a brand new Rails project and want the following to be run every 1 minute:
puts "Time is now #{Time.now}"
How would I add it to the project?
The README says:
class NewsletterJob < Struct.new(:text, :emails)
def perform
emails.each { |e| NewsletterMailer.d...
Trying to reinstall RSpec, and I can't seem to re-add its command to my bin folder.
Mac-Users-MacBook-Pro:bin macuser$ rspec
-bash: /usr/bin/rspec: No such file or directory
>> which rspec
#> returns nothing.
I tried sudo gem install rspec --prerelease a dozen times, bundle install , and nothing seems to give.
What am I missing?
...
I am deploying an app on Ubuntu 10 using Passenger 2.2.15, Rails 2.3.5, Ruby 1.8.7, and Apache 2.2.14. When I open http://localhost/appname it displays the contents of the app's root directory (/var/www/appname). Currently passenger and apache seem to be installed correctly, but this error persists.
/etc/apache2/sites-enabled/appname i...
I have a form where I am trying to do a very simple CRUD operations on rails with MongoDB.
I have my controller
class RecipesController < ApplicationController
def new
@recipe = Recipe.new
end
def update
end
def create
recipe = Recipe.create(params[:title])
redirect_to params[:title]
@recipes = Recipe.all...
Using http://github.com/collectiveidea/delayed_job
It says:
Call .delay.method(params) on any object and it will be processed in the background.
Notifier.delay.deliver_signup @user
If I start a brand new Rails project, and create a scaffold of story, and use either:
class StoriesController < ApplicationController
def index
...
Does anyone know of a way to create a foreign key in Rails 3 using migrations?
...
Hi,
I have a model that has ratings in it for an post.
I want to display a list of the top 5 ratings for a given post, but I am completely lost on where to start. I figure the find method might have something useful, but I'm unsure. I've even considered looping through each record getting its size, adding it to a hash, sorting the has...