I'm a beginner to Ruby and RoR. I went through a book (railsspace) which covers the basics. I understand the basics of how RoR works, REST etc.
Beyond this, I'm not sure how to proceed. In short, my questions are
What topics should I concentrate on, to grow as a RoR programmer?
I checked quite a few books, didn't fully like many of...
I recently upgraded my application from Rails version 2.1.2 to version 2.2.2. It was tested in on development and on my staging system. When I moved to production it fails to load all the way through the environment.rb file. (Why, oh why, is it always on production!?!)
Below is my environment.rb file
# Be sure to restart your web serve...
I have a rails controller handling requests to www.mydomain/foo, now I want all traffic to www.mydomain/ (the domain root or homepage) to go to www.mydomain/foo. I asked a similiar question about how to do this with ReWrite, and haven't gotten an answer yet, but I would be happy also solving it in the controller so I have opened up this...
I have read that errors.add_to_base should be used for errors associated with the object and not a specific attribute. I am having trouble conceptualizing what this means. Could someone provide an example of when I would want to use each?
For example, I have a Band model and each Band has a Genre. When I validate the presence of a ge...
I have a small ruby application I wrote that's an anagram searcher. It's for learning ruby, but I would like to put it up online for personal use. I have some experience with Rails, and many here have recommended Sinatra. I'm fine with either, but I cannot find any information on how to use a text file instead of a database. Is there ...
A rails app I am developing currently has about 35 migrations up to this point. Since the application started as an experiment, there is a fair amount of meaningless churn in the migrations as I went back and forth between different ideas.
Are there any drawbacks to collapsing migrations 1-35 into one migration? I was planning to do thi...
I seem to be having trouble with Rails finding the appropriate path to a textfile I would like to load into memory for processing, for a personal learning project.
require "#{RAILS_ROOT}/lib/english.txt"
or
require "/lib/english.txt"
are not working.
The textfile is located in the lib directory.
I am trying to load it fro...
Hi,
I keep seeing this error in my rails production log, any ideas what the issue is?
Im running rails on apache with mongrel clusters.
RoutingError (No route matches "/://0" with {:method=>:get}):
Not sure what attempted url is causing the error.
Edit: Heres my routes.rb file
ActionController::Routing::Routes.draw do |map|
map.sign...
I have a rails plugin written in v 2.1.1. When I install it in a 2.2.2 app, it breaks the app. I'm unable to use polymorphic routes so something like
<%= link_to @object %>
Doesn't work, because it says:
ActionView::TemplateError (undefined method 'polymorphic_path' for #<ActionView::Base:0x1a95c1c>)
If I script/plugin remove th...
I'm using restful_authentication in my app. I'm creating a set of default users using a rake task, but every time I run the task an activation email is sent out because of the observer associated with my user model. I'm setting the activation fields when I create the users, so no activation is necessary.
Anyone know of an easy way to...
I have a couple models which are associated with the has_many belongs_to pair. For the sake of demonstration, a client has one server but a server has many clients. I might do something like this:
client1.server = the_server
client2.server = the_server
client3.server = the_server
My actual application is quite a bit more complex tha...
When I add a new "product" using my scaffold create rails app, the following line properly adds a new product
@product = Product.new(params[:product])
When I try to add a new product using the following URL (trying to POST data up from a java program).
http://localhost:3000/products?serial=555&value=111
The product is not crea...
I have an HTML document of this format:
<tr><td colspan="4"><span class="fullName">Bill Gussio</span></td></tr>
<tr>
<td class="sectionHeader">Contact</td>
<td class="sectionHeader">Phone</td>
<td class="sectionHeader">Home</td>
<td class="sectionHeader">Work</td>
</tr>
<tr valign="top">
...
As a companion to Hidden features of Ruby.
Try to keep it to Rails since the other is a better place for Ruby-specific examples. One per post please.
...
I am building a REST based API (Read only) for accessing services of my application. I plan on writing a web application that will leverage these APIs to provide basic information on the status of the application. I plan to use AJAX (using jQuery) to show the information.
Originally I planned on using Grails, Spring MVC, RoR or one of t...
I'm creating a mailing list manager using rails.
I've toyed with the idea of generating my own database; one contact will have many details (phone numbers, emails, addresses etc).
But this got me thinking about how others would have done it, and then why not store contacts as vCards in the database. Plus, there's even a gem that helps ...
I have turned ActiveRecord off in my Rails app in the environment config:
Rails::Initializer.run do |config|
config.frameworks -= [:active_record]
end
I have models that do not extend ActiveRecord::Base and I want to unit test these models. When I run the tests I get the uninitialized constant ActiveRecord::Base error.
How can I te...
When generating cache-keys for rendered content in web applications, you have to take into account all variables that might change the result.
In dynamic environments like rails these can be defined in different places: the controller, a model, the session or the server environment. And they can be referenced in the template, in a templa...
Besides Markaby and Haml, are there any better Rails View Templating mechanisms?
...
I'm using the standard active_record_store in my app. In environment.rb I have:
config.action_controller.session_store = :active_record_store
And my sessions table was created with rake db:sessions:create:
create_table :sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :sessions, :se...