Ruby is an open-source dynamic object-oriented interpreted language created by Yukihiro Matsumoto (Matz) in 1993.
0
votes
0answers
10 views
Rails: How to make link_to use another attribute instead of id
The following line will create a link to things/:id
link_to "Thing", @thing
But I need to create a link to things/:some_other_id.
My first thought was that changing the route for /things/:id to ...
1
vote
2answers
15 views
How do I create and return a Ruby class from a lambda?
I'm trying to create a lambda that will return a stub class. This is what I've got:
engine_stub = lambda { |valid|
Class.new {
def valid?(address)
valid
end
}
}
The lambda should ...
0
votes
1answer
7 views
Ruby: Check which version of code is running - interaction with rake install
I have multiple versions of the same ruby code on my machine, e.g. a development one, a rake installed version.
I want to be able to insert some code into the gem to print out which version is ...
0
votes
1answer
17 views
Merging an array of array with an other array
I'm currently discovering ruby and its array manipulation.
What I want to do is pretty simple, but I'm stuck doing it.
Here's what I've got :
first = ...
0
votes
0answers
7 views
How do I get Rake TestTask to execute a Ruby script before testing?
I have a testing "bootstrap" Ruby script that handles test setup (requires libraries, prepares test variables etc.) and I want the Rake TestTask to run this file before it runs the tests. Is this ...
0
votes
1answer
32 views
Simple search function for a list of products - Rails 3
I'm currently self-studing Ruby on Rails 3 out of wanting to code my own apps and designs (total noob). I'm writing up code for a simple product list and I want to integrate a simple search function ...
1
vote
0answers
29 views
ruby method caching performance
I'm using the cache_method gem, and while profiling some critical process in my app I found the following result
6.11 0.01 0.00 6.10 413/413 ...
0
votes
2answers
39 views
how to insert hash into mysql using ruby
Let's say I have a hash:
{"MemberId"=>"MID-0000001", "MemberName"=>"Bruce", "OrderNumber"=>"ON-000000001"}
How can I insert this hash into orders tables of the db database in mysql?
...
0
votes
2answers
31 views
How to encode the text into string in rails?
unit = "Nm³/hr Air"
# => "Nm³/hr Air"
unit.html_safe?
# => false
I want the result of unit.html_safe? as true for to display in the view.
Thanks in advance
0
votes
0answers
32 views
Need help getting rails-settings gem to work
https://github.com/ledermann/rails-settings
I followed the installation instructions, did the migration, restarted server, but here's what I see when I try to get/set in IRB:
1.9.3p374 :126 > ...
0
votes
0answers
30 views
Referencing class from within module required by rake task
I have a rake task in my Rails /lib directory. It requires a module with:
lib/tasks/raketask.rb
namespace :mynamespace do
require "#{Rails.root}/app/concerns/kpis"
end
app/concerns/kpis.rb
...
2
votes
1answer
53 views
Retrieve a file in Ruby
So what I am trying to do is pass a file name into a method and and check if the file is closed. What I am struggling to do is getting a file object from the file name without actually opening the ...
0
votes
0answers
13 views
ActiveRecord::RecordNotFound - Couldn't find Location with id=favicon.ico
I'm running a Sinatra app locally and it works fine but I can't deploy the app to heroku or EC2. I get the following in my log (locally) about the favicon.ico. I've added this file to my app but it ...
0
votes
0answers
7 views
Nasty SSL certificate error occurs in Rails controller, but not in console
This error just keeps popping up at different times. It is absolutely maddening, and productivity-sapping.
This is rvm ruby-1.9.3-p392 and Rails 3.2.13, and Pow.
In the console, this command works:
...
0
votes
1answer
15 views
Authlogic and Invalid Sessions
Background:
I've inherited an older Rails application which I'm attempting to setup a local copy and have run into a problem with the Authlogic gem used for authentication. The setup is as follows: ...