Not sure how to frame this question (I'm still wrapping my head around Rails).
Let's try this:
Say I wanted to implement the user side of Ryan Bates' excellent railscast on nested models. (He shows how to implement a survey where you can add and remove questions and answers dynamically). I want the user's side of this: to be able to a...
I just got my rails 2.3.8 app running on ruby 1.9.1. To get into the console, start the webserver, anything that initializes rails, takes 3 - 4 times longer in ruby 1.9 than in ruby 1.8.7. I'm using ruby version managers so I can easily switch between ruby 1.9 and ruby 1.8.7. The speed difference happens in both production and developmen...
After listening to Rails Cast No 190 I sat down to try it
So I installed nokogiri with
gem install nokogiri
on my Windows 7 Ultimate laptop. I use Ruby 1.9
and this is the way i Installed Nokogiri
C:\Ruby>gem install nokogiri
Successfully installed nokogiri-1.4.2-x86-mingw32
1 gem installed
Installing ri documentation for nokogiri...
Is there some way to change Rails environments mid-way through a test? Or, alternately, what would be the right way to set up a test suite that can start up Rails in one environment, run the first half of my test in it, then restart Rails in another environment to finish the test? The two environments have separate databases.
Some neces...
Hi all,
i'm trying to write a simple gui application to manage ruby version manager.
i started with some stuff like testing how ruby's %x[ ] works..
i made this function
def do ( command )
%x[#{command}]
end
if i try to use this function with one of the rvm commands like "rvm list" or rvm -v i get
a command not found: error.
the s...
We are having problem with libxml-ruby gem at the server side
Possible because it uses x86_64 architecture:
$ uname -a
Linux ip-10-228-171-64 2.6.21.7-2.fc8xen-ec2-v1.0 #1 SMP Tue Sep 1 10:25:30 EDT 2009 x86_64 GNU/Linux
require 'libxml'
LoadError: /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml_ruby.so: ...
I'm looking for a solution that will allow my rails app to render a user-friendly maintenance page when there is no Mysql server available to connect to.
Normally a Mysql::Error is thrown from the mysql connection adapter in active_record. Something like:
/!\ FAILSAFE /!\ Wed May 26 11:40:14 -0700 2010
Status: 500 Internal Server Err...
There are a number of resources online that host Rails and Ruby documentation in various forms and styles. A number of them are good, but none of them document the modules and classes with the methods available from the numerous extensions provided by ActiveSupport and others.
For example, with the Standard ruby Hash class, the core ru...
Hi, I have a class heirarchy as follows:
class A < ActiveRecord::Base
after_create { |i|
#do something
}
end
class B < A
after_create { |i|
#do something else after what A did
}
end
I want to have A's behavior performed in B when after_create is invoked, but I am not sure of the proper way to write the after_create me...
I am trying to figure out how to display a count for records that have been created in a table since the last_request_at of a user.
In my view I am counting the notes of a question with the following code:
<% unless @questions.empty? %>
<% @questions.each do |question| %>
<%= h(question.notes.count) %>
end
end
This is happeni...
Hey i got an White Macbook and, has to go in 10 hours to a conference. And I'm having a lot of problems.
First, I wanted to have Rails 3, so I used MacPorts to install Ruby 1.8.7. It worked well ;)
So now I was thinking I should install Rails 3.. but no, no!.. it says..
$ sudo gem install rails --pre
ERROR: Error installing...
I noticed that the code in the rails framework is using the following convention all over the place:
class SomeClass
class << self
def some function
end
end
end
rather than
class SomeClass
end
def SomeClass.function
end
and
class SomeClass
def self.somefunction
end
end
What is the reason for this design choice...
I've been using Python for most of my web projects lately, and have come to really love the Pylons MVC framework. I like the incredible transparency (lack of magic), the built-in components they selected (sqlalchemy, formencode, routes), and the ability to easily change things up (use a different ORM or templating engine).
Moving forwa...
advise the decision to build a survey for users on RoR or PHP
...
I'm new Ruby but been a .net dev for many a year. I want to implement composition within a couple of my model to make sure they are as loosely coupled as possible but have no idea where to start, or if this is really needed and I'm still thinking to much like a .net dev.
Can anyone give me some pointers on where to start.
Cheers
Colin ...
After validation, i got error and return back to :action => :new.
Some field on form already filled, so i want to keep them filled afterr error message too.
How it can be done?
Thanks.
...
Hi-
I'm trying my hand at using the Viewpoint gem (by zenchild @ github) as the base for a meeting scheduling system. It's great at reading calendar information from regular Exchange 2007 accounts, but I got stuck trying to change the SOAP request header to allow me to read resource accounts as a delegate.
I came across http://blogs.m...
Hi All,
I am developing my first rails site (yup, i am a rails idiot).
I'm writing a blog, and i got to the comments part.
I installed acts-as-commentable-with-threading ( GitHub ), i made and ran the migration like the install instructions said.
I have added acts_as_commentable to my Posts model and i have a Comments controller
When i a...
I have 2 date ranges, start_date1..end_date1 and start_date2..end_date2, is there an easy "ruby" way to find all the dates that are in both ranges?
...
I have vendors/show view with button "Add new item" button. When i press "Add new item", it leads to items/new view with select which contain all Vendors.
I want to send vendor id value to items/new, that way it will be possible to show correct Vendor on my select.
How it can be done RIGHT?
...