I have a form that allows entry of data corresponding to multiple rows in the database table.
How do I model such a thing with ruby on rails ?
In all my Ruby on Rails samples, I have a controller, model and view. The view displays the content from the model and the model corresponds to a single entity.
As an example : I have a database...
Is there a way I can query the database to return only the elements that have happened successively (in time) according to a set variable?
Specifically, I need to find out how many times the user has won a game in a row. The games are stored in the database with an attribute win_loss (1 is win, 0 is loss).
I would like to see if the u...
inside my warbler config file I have the following:
config.webxml.rails.env ='development'
i build my war, and deploy with the tomcat web utility, and when I go to the app it doesn't run, but instead of getting the development backtrace to help me figure out what isn't getting setup right, it just gives me the production 505 error pag...
I have two models I want to connect with an m-to-m relationship, but I want the relationship to have some data of its own, such as a date due or a count or something like that...
Suppose I have Users, Groups, and some UsersInGroups object, where users and groups both have a has_many X, :through Y relationship. UsersInGroups belongs_to a...
Hi I am using Devise 1.0.3 and Rails 2.3.5
My user has the following devise line:
devise :authenticatable, :confirmable, :recoverable, :registerable,
:rememberable, :trackable, :validatable
I would like to customize where the application redirects the user to, after requesting instructions for a password reset.
For other regis...
I'm working on something in ruby and trying to figure out if it can be turned into a gem. I can find documentation on how to make a gem and gem manuals, but I can't find anything that says, "here is what a gem can and cannot do."
Let's say I created some code, which of the following can a gem do?
1) Use rails conventions like views and...
This is not really technical but I could not find a better place to ask this Question than SO.
I have a full time gig but recently someone I know wanted to get an application done that would send mass emails/texts to users who are related to a particular group.
I am an OK RoR developer so have decided to do it in RoR. Following is b...
I have a capistrano task that consolidates the deployment of multiple stages of a Rails project.
For example:
task :consolidated_task do
build #creates a new release branch from master,
#sets a variable with the relese branch name
staging
deploy.migrations
production
deploy.migrations
end
Is this the ...
I've had a problem with the following issue in Rails and ASP.Net MVC. Often there are multiple widgets of functionality on a page, yet one controller action is supposed to render the page. Let me illustrate:
Let's say I have a normal e-commerce site, and the menu is made of categories, while the page is to display an group of products...
I'm using Thinking Sphinx to power the search on my Rails application.
I know the guide explicitly says that you can't index model methods, but I would like to. Specifically, I have a model whose instances can be tagged through a has_many_through relationship via acts_as_taggable_on_steroids. The important caveat: the model also nests ...
I have a standard rails application, that uses a mysql database through Active Record, with data loaded through a separate parsing process from a rather large XML file.
This was all well and good, but now I need to load data from an Oracle database, rather than the XML file.
I have no control how the database looks, and only really nee...
I have a question relating to minimizing some code I'm working with. I am using the map-fields plugin/gem to allow my user to select what fields in a CSV file will map to attributes in a model.
map-fields with upload
The map-fields plugin uses the name of a select object in the plugin to determine where the CSV columns match up too....
Today is the first day I'm looking into Ruby on Rails, and now I'm stuck. I have two scaffolds, artist and song.
In songs/new.html.erb, I have these lines:
...
<%= f.label :name %><br />
<%= f.text_field :name %>
...
<%= f.label :Artist %>
<%= collection_select(:song, :Artist, @artists, :id, :sort_name) %>
...
In the form for creatin...
I am trying to configure a rails server to use PostgreSQL, but getting stuck when installing the postgres gem. I have installed PostgreSQL successfully on the machine (and can use it for other applications) but am getting an error when attempting to install the ruby gem for it.
I do: sudo gem install postgres
And get the following outp...
In the following example,
before_filter :foo
before_filter :bar
before_filter :wah
prepend_before_filter :heehee
prepend_before_filter :haha
so then the execution orders will be:
haha, heehee, foo, bar, wah? <-- note that haha is actually before heehee
And is there a reason not to list haha and heehee first in the first place bu...
I have an interactive Ruby on Rails application which I would like to put into a "read only mode" during certain times. This will allow users to read the data they need but block them from actions that write to the database.
One way to do this would be to have a true/false variable located in the database that was checked before any ...
Is it possible to use concurrent databases in one rails application?
With AR I can use establish_connection method inside a model. Is it possible with datamapper?
...
function replaceIfEmpty(fieldID, value){
alert($j('input#'+fieldID.val()));
if ($j('input#'+fieldID).val() == ""){
$j('input#'+fieldID).val(value);
}
}
there's my function, and this is in my controller:
page << "replaceIfEmpty('object_name', '#{t.name}');"
but when all this is invoked, an alert tells me:
R...
I am changing my site over from Google App Engine to rails and I would like to keep my place in google search. Currently my site uses a URL /page?pid=microsoft-interview-questions to access the Microsoft subsection of interview questions. How would I create a route that can send this to '/tags/:id' where :id would be microsoft in this ca...
I'm having trouble wrapping my head around more advanced Rails query methods. In this case, I have three tables: Users, Friendships, and Events.
I have set it up as follows in the models for each
User-> :has_many => :friendships, :has_many => :items
Friendship-> :belongs_to => :user
Event-> belongs_to => :user
Friendships are sim...