I have some standard nested routes in my app, and I want to implement subdomains using the subdomain-fu gem. So I'm currently doing this:
example.com/stores/name_of_store/products/name_of_product
and I want to do this:
name_of_store.example.com/products/name_of_product
There seems to have been some discussion about the failing...
I'm doing maintenance work on a Rails site that's deployed using Phusion Passenger. The workflow is a little different than the standard three-tiered Railsian test-dev-production arrangement; instead, there are two separate installations of the same codebase running against parallel Oracle databases; the dev site lives at qa.domain.com,...
Hello,
I have the following hash of countries;
COUNTRIES = {
'Albania' => 'AL',
'Austria' => 'AT',
'Belgium' => 'BE',
'Bulgaria' => 'BG',
.....
}
Now when I output the hash the values are not ordered alphabetically AL, AT, BE, BG ....but rather in a nonsense order (at least for me)
How can I output the hash having the ...
Hello, I'm looking for any pointers on how to write a rails web app without ActiveRecord.
A doc or an example of a (not too complex) web app using storage backends other than a relational database would be greatly appreciated.
It's not clear on what should be implemented in the model classes in order to make the rails app work without ...
I have a Ruby on Rails app running on my server, and I can't figure out how it was deployed (someone else set it up).
The app is located in /var/www/myapp. Before it was deployed, I had been able to go in there and make minor edits to the app. The person helping me out with RoR then "deployed" it. It was unclear what deploying actually ...
I have a many-to-many relation between labels and files (using rails). The labels model is also a nested set (awesome nested set plugin) that allows the lables to be organized in a hierarchy like:
Multimedia
Video
mpeg-4
h264
theora
Audio
mp3
aac
vorbis
To access all the files under the Video label I would have to create some ...
Hi all,
I have a fully functioning rails app with authlogic and openid as per railscasts episode 170 (http://railscasts.com/episodes/170-openid-with-authlogic). The problem comes when I want to add recaptcha and a user signs up with openid.
Apparently the verify_recaptcha method overrides the openid parameters. There must be a way to g...
Hi,
I have a user model, a movie model and this association in user.rb (I use has_many :through because there are other associations between these two models):
has_many :has_seens
has_many :movies_seen, :through => :has_seens, :source => :movie
I'm trying to get an array of the ten most recent has_seens associations created.
Fo...
Here's some code, this is my NewsItem model as you can see...
class NewsItem < ActiveRecord::Base
belongs_to :country
has_attached_file :image, :styles => { :original => '57x57' }, :default_url => '/images/football.png'
# has_attached_file :image,
# :styles => { :original => '57x57' },
# ...
I have map.resources :posts and I want to be able to serve post bodies in markdown format. So I set up my respond_to block:
respond_to do |format|
format.markdown {
render :text => @post.body.to_s
}
end
But when I try to access /posts/1234.markdown, I get this error:
NameError (uninitialized constant Mime::MARKDOWN):
app/co...
I'm already using gravatar icons for the users of my web service. However, I'm finding several problems with this approach:
Only a small percentage of the users take the time to set up a gravatar profile. My users are not tech-savvy, but would be likely to add a dedicated photo to my site.
Users of my service are encouraged to use imag...
Hi all,
I'm fairly new to both Rails and Heroku but I'm seriously thinking of using it as a platform to deploy my Ruby/Rails applications.
I want to use all the power of Heroku, so I prefer the "embedded" PostgreSQL managed by Heroku instead of the addon for Amazon RDS for MySQL, but I'm not so confident without the possibility to acces...
I want to use the f.label method to create my form element labels, however - i want to have the form element nested inside the label. Is this possible?
-- From W3C --
To associate a label with another control implicitly, the control element must be within the contents of the LABEL element. In this case, the LABEL may only contain o...
A very simple HTML in my .erb file:
<a href="javascript:void(0)" id="xyz">Click</a>
But when browsing this code in the browser, I get the link which text is:
Click (javascript:void(0)).
Could you please help me explain why it is? Thanks much for your help.
My development environment:
Ruby 1.8.7
Rails 2.3.4
...
I am attempting to beautify my routes so that they follow the syntax of lists/name-of-list/id as per here: http://gregmoreno.ca/how-to-create-google-friendly-urls-in-rails/
I have defined a new route like so:
map.list_permalink 'lists/:name/:id', :controller => 'lists', :action => 'show'
Everything works fine, but my existing ajax met...
I am using STI and am wondering, do I have to have a separate controller for each model? I have a situation where I only use the create and edit actions for one model in the STI relationship, but I get an 'undefined method' error if I try to do a form for. More specifically, I have two models that inherit from List:
class RegularList ...
One of my favorite features of Google docs is the fact that it's constantly automatically saving versions of my document as I work. This means that even if I forget to save at a certain point before making a critical change there's a good chance that a save point has been created automatically. At the very least, I can return the documen...
I'm having an issue with one of my controller's AJAX functionality. Here's what I have:
class PhotosController < ApplicationController
# ...
def create
@photo = Photo.new(params[:photo])
@photo.image_content_type = MIME::Types.type_for(@photo.image_file_name).to_s
@photo.image_width = Paperclip::Geometry.from_file(param...
I set up Cucumber+Webrat+Selenium according to this article.
Whenever I run my server, though, I keep getting:
ERROR Server Exception: sessionId should not be null; has this session been started yet? (Selenium::CommandError)
Two hours on Google haven't done much for me. Could you please help out? Thanks!
I am working on Ruby 1.8.7 and R...
Is there anyway to throw a validation error if a user tries to upload the same photo twice to a Rails app using Paperclip? Paperclip doesn't seem to offer this functionality...
I'm using Rails 2.3.5 and Paperclip (obviously).
SOLUTION: (or one of them, at least)
Using Beerlington's suggestion, I decided to go with an MD5 Checksum c...