3
votes
2answers
3k views
cannot load such file — script/rails : Getting this error while remote debugging through RubyMine
I am getting following error while remote debugging through RubyMine IDE.
$ bundle exec rdebug-ide --port 1234 -- script/rails server
Fast Debugger (ruby-debug-ide 0.4.9) listens on :1234
...
30
votes
3answers
5k views
STI, one controller
I'm new to rails and I'm kind of stuck with this design problem, that might be easy to solve, but I don't get anywhere:
I have two different kinds of advertisements: highlights and bargains. Both of ...
30
votes
6answers
16k views
f.error_messages in Rails 3.0
Rails 3.0 deprecated f.error_messages and now requires a plugin to work correctly - I however want to learn how to display error messages the (new) native way. I am following the getting started ...
36
votes
7answers
15k views
Rails 3: Get Random Record
So, I've found several examples for finding a random record in Rails 2 -- the preferred method seems to be:
Thing.find :first, :offset => rand(Thing.count)
Being something of a newbie I'm not ...
34
votes
5answers
25k views
How make a HTTP GET request using Ruby on Rails?
I would like to take information from another website. Therefore (maybe) I should make a request to that website (in my case a HTTP GET request) and receive the response.
How can I make this in Ruby ...
30
votes
6answers
4k views
Rails 3 OSX - Speed up Console Loading Time
I am wondering if there is any relatively easy way to speed up my console load time, which is starting to approach 30 seconds. I have a lot of subclasses whose methods don't seem to be affected by ...
26
votes
2answers
21k views
Convert UTC to local time in Rails 3
I'm having trouble converting a UTC Time or TimeWithZone to local time in Rails 3.
Say moment is some Time variable in UTC (e.g. moment = Time.now.utc). How do I convert moment to my time zone, ...
39
votes
10answers
4k views
do..end vs curly braces for blocks in Ruby
I have a coworker who is actively trying to convince me that I should not use do..end and instead use curly braces for defining multiline blocks in Ruby.
I'm firmly in the camp of only using curly ...
22
votes
12answers
14k views
Why is Rspec saying “Failure/Error: Unable to find matching line from backtrace”?
I'm following the rails tutorial here: http://railstutorial.org/chapters/filling-in-the-layout#top
When I run "rspec spec/", I get a bunch of errors that look like this:
1) LayoutLinks should have a ...
4
votes
2answers
15k views
Rails 3 and RJS
I use the rails 3.0.0.beta
Is there any new syntax to write RJS, here is an example
def remote_create
@photo = Photo.new(params[:photo])
respond_to do |format|
if @photo.save
...
29
votes
3answers
9k views
Ruby: problem installing EventMachine under Windows 7
I am trying to install the gem EventMachine on Windows 7 (using Ruby 1.9.2 with RubyInstaller) via bundle, but I get the following error. I also installed DevKit and it is working, but I still can't ...
5
votes
3answers
6k views
undefined method `eq' for nil:NilClass with rails 3 and ruby enterprise on ubuntu hardy
I am not sure what causes this error but since I came across this issue in passenger and now in the console as well I am thinking maybe the mysql driver is the problem?
Everything works as expected on ...
32
votes
3answers
11k views
Ruby on Rails Callback, what is difference between :before_save and :before_create?
could you explain me in detail about :before_save and :before_create in RoR callback ? And what to do with rails validation ? Is validation works after :before_save or :before_create ?
52
votes
8answers
22k views
Rails 3 - no such file to load — openssl
when running a Rails server, I get the following error:
no such file to load -- openssl
I try a solution I find online. I go to ~/.rvm/src/ruby-1.9.2-head/ext/openssl. I type : ruby extconf.rb, but I ...
51
votes
4answers
22k views
Pass a variable into a partial, rails 3?
I have a loop like such:
<% @posts.each do |post| %>
<% render middle %>
<% end %>
Then in my middle partial, how do I access the current post?