I'm using the following code for a date field:
<%= f.input :date_of_birth, :selected => nil,
:order => [:day, :month, :year],
:prompt => {:day => "Day", :month => "Month", :year => "Year"},
:start_year => Time.now.year - 15,
:end_year => Time.now.year - 100 %>
Everything works as expected, except for :sel...
Should the following test assert an exception was thrown? On my pc it doesn't and I want to know if this is expected behavior.
def a
raise RuntimeError
end
def b
begin
a
rescue RuntimeError
puts "bummer"
end
end
test "assert this" do
assert_raises RuntimeError do
b
end...
For you rails programmers, what's the easiest way to keep your RDoc files up-to-date?
I know I can run rake doc:app manually, but I really don't feel like adding a manual step to the check-in process, and since we're already using cruisecontrolrb to handle deployment and testing automation, it seems like there should be an easy way to r...
Hi,
I'm making a rails app which should receive e-mails. So I made a little research and figured out that I should use Fetcher plugin. But the problem is that I don't know how to use it!
Please help...
...
How to send emails with "Rails 2.2.2 + Gmail"? I have tried several methods with smtp_tls, but not succeed. Who can give me an available tsl plugin download link and an actionmailer smtp_setting?
...
I've never really delved into the amazing cache techniques Rails provides until now. One thing that I really can't wrap my head around is how to resolve a this particular problem.
Given that I have a Blog model with many Posts:
class Blog < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
named_scope :publish...
Hi!
I'm spending my first few days with cucumber/selenium trying to figure out whether RBB is the thing I want to use in my latest RoR project.
My setting: Rails 2.3.5, selenium-client 1.2.17, cucumber 0.4.4 etc, quite current in my view.
Following the instructions on http://wiki.github.com/aslakhellesoy/cucumber/setting-up-selenium ...
I transfered a project to a new machine. Everything works. I can run migrations and they update the mysql database. However, the schema.rb file doesn't acknowledge the changes. I checked the read/write permissions for schema.rb are OK. Does anyone have any idea about what could cause this problem. I'm using Rails version 2.3.5. ra...
Situation:
There is a Project Resource that has many Resources A each of them having many Resources B
When a new Project is created it shall already start with clones of Resources A having clones of Resources B
There shall be a Reference Project whose Resources A and B (through A) are cloned from
Cloning is done because in this way new...
I have a lot of dynamic pages in German.I want to translate them to English. After translation, i have to insert them to database. Are there any plugins that uses Google's Language API ? Thanks
...
I have a class which performs several database operations, and I want to write a unit test which verifies that these operations are all performed within a transaction. What's a nice clean way to do that?
Here's some sample code illustrating the class I'm testing:
class StructureUpdater
def initialize(structure)
@structure = struc...
I have a RoR site that loads a splash page on the first visit. It's simply a page with information about the service and a form to enter credentials. When the user logs in, the form submits to the same page (document root) but if the user is logged in successfully, the actual site is loaded. My issue is that when the user presses the bac...
Got an app running great on Heroku, only issue is that their custom-domain SSL solution is way expensive (http://docs.heroku.com/ssl), leaving piggybacking of their *.heroku.com as an only viable option. The good thing is that my app only requires SSL for a couple of pages (for ordering). Right now, I use "ssl_required" in my controlle...
I have the route
map.member 'members/:id/:name_url', :controller => 'members', :action => 'show', :requirements => { :id => /\d+/ }
and on my Member model I have a name_url method which takes the name and converts it to lowercase and changes spaces to dashes
the problem is that if I run
link_to "Bill", member
it gives me an "membe...
Hi guys,
I've been trying to create an order confirmation page for my rails app, and am not quite sure how to go about it in a restful way.
There were a few answers on this question that got me halfway there, but the problem was that I wasn't quite sure how to set up the form in the rails view so that it would take the user to a confir...
I am trying to setup dnamic routes in my rails application.
i.e.
I have a acts model that has a name attribute.
name:string.
What I a trying to do is use that name as my url.
in my route if have
map.connect 'blacktie/:id', :controller => 'acts', :action => 'show', :id => 3
That takes me to http://0.0.0.0:3000/blacktie
I know...
Hi
How can I future-proof my client URL links to my server for future HTTPS migration?
I have a .net winforms client talking to my ruby on rails backend. If I move the website in the future I want to make sure that my API links from the client don't have to change.
Or is this something a hosting provider can let you configure.
Oh, a...
Hi there,
I have a data model that contains a DateTime attribute, date. I want to find out if that date is today. I'm having a hell of a time!
>> Deal.first.date
=> Mon, 14 Dec 2009 23:59:59 EST -05:00
I've tried so many techniques that I would be embarrassed to put them here. So I would just ask, what do I need to match this date in...
This question was here for other languages, so let here be one for Ruby.
How do I calculate number of complete years that have passed from a given date? As you probably have guessed, that's to calculate person's age automatically. The closest one is distance_of_time_in_words Rails helper, so the following template
Jack is <%= distanc...
I know how to run functional/integration tests in Rails, this question is about best practices. Let's say authorization is performed using four distinct user roles:
basic
editor
admin
super
This means that for each action there are up to five different behaviors possible (4 roles + unauthenticated/anonymous). One approach I've taken ...