Should AJAX calls that are not RESTful be:
put in the controller that most suits their functionality/view, or
bundled together into their own separate 'Ajax' controller?
I've been doing 1, but I've just read this (2725 diggs) article
http://zygote.egg-co.com/10-dirty-little-web-development-tricks/ (see point 9)
and this chap opts f...
I would like to start another process when mongrel rails starts up. Is there a way to do this? I am looking to start lighttpd which acts as a media server on my project every time rails starts and stop it every time rails stops.
...
I have used restful-authentication and I have "public" layout and a completely different "members" layout. When someone visits my root (defaults to public) how can I check if they are logged in and redirect them to the member's section?
...
I am a .Net / SQL Server developer via my daytime job, and on the side I do some objective C development for the iPhone. I would like to develop a web service and since dreamhost supports mySql, python, ruby on rails and PHP5, I would like to create it using one of those languages. If you had no experience in either python, Ruby on Rai...
When a user submits a form and leaves certain fields blank, they get saved as blank in the DB. I would like to iterate through the params[:user] collection (for example) and if a field is blank, set it to nil before updating attributes. I can't figure out how to do this though as the only way I know to iterate creates new objects:
col...
Hi there,
I'm trying to create an association between two models using join conditions rather than a foreign key. Does anyone know if this is possible?
For example I want to join products to pricing points. A product has a price and a pricing point has a minimum and maximum amount and a name. Eg. Min = 0, Max = 20, Name = Less than $20...
I want to make a request to a SOAP Web Service but I don't want to install any gems.
Is there any way to just make the request using plain XML?
I think it's trivial but there might be something I've missed, because all implementations/tutorials were using a gem.
I think that the SOAP response, can be handled also as a XML response rig...
I would like to use the ruby on rails and mysql to write a simple test program
but, in this time, i can not update the database record.
because i use the "mid" to replaced the "id" column
in this case, what can i do to work to update the record?
Problem:
Mysql::Error: Unknown column 'id' in 'where clause': UPDATE `messages` SET `messag...
I have a model named "clothing" which I want to be the singlular (one piece of clothing). By default, rails says the plural is clothings. Right or wrong, I think it will be more readable if the plural is "clothes".
How do I override the plural naming convention? Can I do it right in the model so I don't have to do it over and over?...
I am looking for good solutions for tracking and organizing cucumber features and scenarios. I need something that can be remotely accessible for customers and developers. Something hosted would be preferable.
...
Entering my address via a traditional form drives me crazy:
Why do I have to enter my city, state, and zip code when my city and state can be inferred from my zip code?
Choosing your state from a dropdown list is a pain in the ass -- often you can't tab into it, you have to use the mouse, etc.
Because I find this process so repulsi...
In our Ruby on Rails project we have a lot of categorization criteria for recipes, such as cook method, occasion etc. Every recipe belongs to one or several of these categories. When someone starts browsing for recipes, he/she can narrow down to a set of particular categories. Then we need to calculate the number of recipes in all catego...
I am (as I'm sure many of you are) pretty familiar with Rails' MVC design pattern as well as Django (and others') MTV design patter. I was wondering what other patterns other frameworks use for web application development. What are their strengths/weaknesses?
thanks
...
I unpacked a gem into my vendor/gems directory and tried to run my Rails app.
I got this message:
Unpacked gem in vendor/gems not in a versioned directory
I don't understand this error and judging by the Google search results for this error there are not many people who have experienced this problem.
Could this mean I also need to v...
For learning purposes, I'm looking for open source Rails projects that exemplify idiomatic usage of RSpec for BDD. I can find projects, but I'm not experienced enough with Rails or RSpec to know whether what I'm looking at represents best practices. Thanks!
...
I'm trying to find the "best" way to set default values for objects in rails. Best I can think of is to set the default value in the "new" method in the controller. Anyone have any input on if this is acceptable or if there's a better way to do it?
...
I have a partial that I want rendered with a collection and another variable. Is it possible to pass more than one variable to a partial?
To illustrate:
Category HABTM Brands
This is just semi-pseudo-code, but I want to do something like:
<% @categories.each do |c| %>
<%= c.name %>
<%= render :partial => "mypartial", :collec...
Cucumber generates out some neat webrat regex steps. I encountered a problem when I tried the this.
In feature:
And I fill in "Telephone (Home)" with "61234567"
In webrat steps:
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
fill_in(field, :with => value)
end
The error encountered:
Could not find field: "Telep...
Right down to business....
There are tasks, which have assigned users
class Task < ActiveRecord::Base
has_many :task_assignments, :dependent => :destroy
has_many :assigned_users, :through => :task_assignments, :source => :user
validates_associated :task_assignments
end
And users have assigned tasks
class User < ActiveRecord::Base...
I'm looking for a Rails project on github that demonstrates best practices for writing a Rails application. Could anyone recommend one?
...