I want to localize a form in my app so that all the labels are in Finnish. This is easy with all other form components, but how do I do this with a file field? It always seems to give me a label "choose file" in the button and "no file chosen" immediately after the button.
...
In my application I have a variety of date sequences, such as Weekly, Monthly and Annually. Given an arbitrary date in the past, I need to calculate the next future date in the sequence.
At the moment I'm using a sub-optimal loop. Here's a simplified example (in Ruby/Rails):
def calculate_next_date(from_date)
next_date = from_date...
Hi, I've been looking for a Ruby implementation of Fedex and UPS.
I've been through their documentation, and think it's really overcomplicated (I'm a bit of a ruby "newbie" myself), so was looking for something simpler. I would only like to use the tracking function.
I found a library called shipping (http://shipping.rubyforge.org/), b...
I have complex form similar to a recent Ryan Bates screencast
The nested elements work fine however. I'm creating or updating a grid of data such as this through a form where the day's prices are the input. My problem begins when they leave one blank. I have the nested_attributes_for option for not saving nils and it works, if they o...
I have Product model and it has many categories with a has_many :through association
In my controller I am trying to do a find by with categories.category but it comes up with a mysql error.
Model.find(:all, :conditions => ['categories.category_id = ?', @category.id ])
Ideas?
...
I am using the "in_place_editing" plugin for rails to render a form with in-place edits. Thing work fine as long as the default template is chosen by rails (no 'render' method is invoked inside the controller), but they break down when I try to render a partial using "render :partial => 'partial_name'" call. Is this a known issue (in_pl...
How to set up HTTP authentication in a Rails application running on WEBrick?
...
Example:
I have 2 partial _map.haml and _bigmap.haml.
:: _map.haml
- content_for :map do
%script{:type => "text/javascript", :src => "http://maps.google.com/maps/api/js?sensor=true"}
...
:: _bigmap.haml
- content_for :bigmap do
%script{:type => "text/javascript", :src => "http://maps.google.com/maps/api/js?sensor=true"}
.....
How am I supposed to test the typical User <-habtm-> Groups story. My Users and groups are created with factory_girl, it means I don't know the group id so I cannot ask webrat to check the checkbox.
Thank you for any webrat steps hints
...
I'm running rails version 2.3.5 and rubygems version 1.3.6, when I script/server I get this error
Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again:http://rubygems.rubyforge.org
any ideas how to fix this?
...
I love programming. It keeps me busy, interested and I get some satisfaction after crossing a brick wall. I still have a year to go before I graduate. I like Java, but there is a lot of competition for entry level positions in Java.
I am familiar with PHP and I am doing a project in PHP.
I want to be very good at something which will b...
Ok, so we're upgrading a client's legacy code from 2.0.2 to latest rails. Most of the basics were easy to fix, but I can't get to the admin screens. Every time we hit "current_user" we get a "stack level too deep" error.
I've dug deeply into the code (read: flailed around a lot at random) and I've finally narrowed it down to the ActiveR...
I have a controller that generates HTML, XML, and CSV reports. The queries used for these reports take over a minute to return their result.
What is the best approach to run these tasks in the background and then return the result to the user? I have looked into Backgroundrb. Is there anything more basic for my needs?
...
I would think this is a Ruby difference, but I'm using the same Ruby version 1.8.7. This is related to this post (to answer "why do you need this?"). This code works in 2.2.2
Loading development environment (Rails 2.2.2)
>> module ActionMailer
>> Utils.normalize_new_lines("blah")
>> end
but in 2.3.5 it fails
Loading development envir...
How to use cryptography with XML documents used for rails Active resources? Or, is there any way to garantee security and integrity with comunications through rails Active resources?
...
I am currently directing all traffic that is subdomained and/or cnamed to my site to a controller called external and a method called handler.
This has gotten really messy and I would like to clean it up. I would like all external requests to be handled the normal rails way ":controller/:action/:id" however, I want these controllers in...
Hi!
I have a website where in the category 'show' action a list of products is shown.
I successfully paginate with the will_paginate plugin and made this work with page caching by configuring my routes like Sean Behan does: http://seanbehan.com/ruby-on-rails/how-to-use-pretty-urls-with-rails-will_paginate-plugin/.
But I would love to ...
OK, this one is a doozy. I have an ActiveRecord object that, among other things, includes a relationships as follows:
class Sample < ActiveRecord::Base
has_and_belongs_to_many :related_samples,
:class_name => "Sample",
:join_table => "related_samples",
:for...
So, I'm working on a project that uses the acts_as_taggable_on_steroids gem. I've installed it as a gem, and it works great and all. Here's where I'm running into problems though - I want to generate a list of the top 25 used tags, and the number of times they've been used across all taggable items.
Well, as it happens, acts_as_taggable...
I have a string template as shown below
template = '<p class="foo">#{content}</p>'
I want to evaluate the template based on current value of the variable called content.
html = my_eval(template, "Hello World")
This is my current approach for this problem:
def my_eval template, content
"\"#{template.gsub('"', '\"')}\"" # gsub to...