I'm trying to recreate a race condition in a test, so I can try out some solutions. I find that in the threads I create in my test, ActiveRecord always returns 0 for counts and nil for finds. For example, with 3 rows in the table "foos":
it "whatever" do
puts Foo.count
5.times do
Thread.new do
puts Foo.count
...
Hi everyone,
I have a three-table system: Companies, Customers, and Matches. The matches include, for example, private notes that each party makes about the other and some options they can set regarding the other.
I have two sets of views centered around Companies and Customers for each party to look at the other and modify their notes...
I'm looking for some general guidance as to how to return a user back to the original page they were viewing after trying to log-in.
The way I have the site setup now is that if a user visits the Store page, for example, and then clicks the login button in the upper right, the user is returned to the default landing page.
Any help woul...
I have this new project I need to build. I want to have at least started on it by the end of this month. So which version should I use though? Should I just stick with the stable Rails2 or try to use Rails3 so I won't have to migrate later? Which one would you suggest for someone that is still learning Rails?
...
Hi, everyone: I am also open to just straight-up refactoring what I'm finding to be pretty repetitive, but to give a baseline of how it's working....
I have for every contact a Campaign, which has_many of three types of Models: Email, Call, and Letter.
When an Email (Call or Letter) has been executed for a specific contact, I have a C...
Hello All
This is my first post here. I have a rails server I'm running on a dedicated server that I have jail shell access to. I can start up a rails server and access it just fine using the text-based browser elinks running in that jail shell using both internal and public IP's. However, I cannot access the rails server from outsid...
Hi,
I am trying to setup an ror app but I keep getting this error. Any ideas as to what may be causing the problem?
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support...
I would like to do is to know if a user has been created in the system in the last 10 second.
so i would do:
def new_user
if(DateTime.now - User.created_at < 10)
return true
else
return false
end
end
IT is just an idea , how can i do it correctly?
thank you
...
I have a model called Contact_Email. When an Email template is sent through ActionMailer to a specific Contact, as part of the Create action it sends it through upon .save.
However, I want to create a "skip" action which also creates a Contact_Email, but does NOT send an ActionMailer and allows me to set the status differently.
I want...
i would like to write a message using an instince variable in the new invition action like this. redirect_to new_invitation_path("invite your friend")
Controller invitations:
def new(message)
@message = message
@from_user_id = facebook_session.user.to_s
end
Apparently it is not possible how can i find a way around this?
...
I know you can do something like:
"SomeWordHere".underscore.gsub("_", " ")
to get "some word here".
I thought that might be a little too much for something so simple. Is there a more efficient way (maybe a built-in method?) to convert "SomeWordHere" to "some word here"?
...
Hi,
I'm been developing Ruby on Rails previously. I'm now looking at an ASP.net web app and I'm looking at WebForms and MVC. As I look at MVC it feels as if I'm looking at the result of something a Ruby on Rails developer implemented after being forced to work in MS land. So I'm wondering:
Was MVC more or less taken directly from Ru...
I have managed to run a basic rails app1 on App Engine using:
http://gist.github.com/268192
So, on my basic app2, I install CE, which works fine on local machine.
(communityengine.org)
But, when I follow the same steps on my actual app2, where
community_engine plugin is installed and all the gems are frozen, the
app engine installer sc...
Is there anything like Merb Parts in Rails 3 out there now?
I've seen Rails Cells, but felt like nobody was using them.
What are your thoughts? Are these suitable for widgets?
...
Dear all,
I have decided to develop a native iPhone apps as a compliment to our webapps. Now I am wondering what are my options to send data remotely from the iPhone apps - since the database is online - to our online database. What I can think of on top of my head - since I come from web dev background - is JSON. My webapps is built us...
Hey guys,
I'm going to try and describe the code in my view, without actually posting all the garbage:
It has a standard shell (header, footer etc. in the layout) this is also where the sub navigation exists which is based on a loop (to find the amount of options) - on this page, we have 6 subnav links.
Then in the index view, we have...
Hi,
I have a system for the users to be able to post comments.
The comments are grasped into a textarea.
My problem is to format the comments with br tag to replace \n
In fact, i could do something like that
s.gsub(/\n/, '<br />')
But the xss protection including in rails escapes br tags.
So i could do this
s.gsub(/\n/, '<br />...
Hi to all,
I'm new to the Ruby world, and there is something unclear to me in defining associations between models. The question is: where is the association saved?
For example, if i create a Customer model by executing:
generate model Customer name:string age:integer
and then i create an Order model
generate model Order descriptio...
I'm using application.html.erb in the views/layouts folder of my Ruby on Rails web app as a template. But there's one page in which I don't want the template to be used. Is this possible?
...
I've just gone to installed RoR on my snow leopard mac.. and found the rails gem was already installed..
is this normal? Does it need updating?
Does this get installed along with textmate?
...