Ruby is an open-source dynamic object-oriented interpreted language created by Yukihiro Matsumoto (Matz) in 1993.
0
votes
3answers
15 views
define sum function in Ruby
Please help, I am a Ruby student, I know how to do the .sum method but not this:
how do you define a sum function for an array so that providing any elements will result in the sum of them. The format ...
2
votes
3answers
19 views
Pair elements from two different Arrays into a Hash in Ruby
Let's say I have this two Arrays:
a = [1, 2, 3, 4, 5]
b = [6, 7, 8, 9, 10]
What I want to get is a Hash as follows:
c = { 1 => [1, 6], 2 => [2, 7], 3 => [3, 8], 4 => [4, 9], 5 => ...
0
votes
0answers
5 views
Build UDP datagram in Ruby
Is there anything in the Ruby library, or as a Ruby gem, that would help me construct a UDP datagram? I've looked into sockets, but there doesn't seem to be a way to simply build one and not send it.
...
0
votes
0answers
5 views
Rhomobile: Read txt file and show content Ruby
i want to open, read and show a txt file in my Rhomobile app.
First, i want to show the complete content of the file. But here is my problem.
def text
fileName = ...
0
votes
0answers
10 views
how to run ruby script in rails server
I have to run a ruby script in rails server. Because my cronjob is written ruby script.
But when I ssh into the server and execute
ruby script.rb
it says
ruby command not found
also I run
...
0
votes
0answers
11 views
SublimeText2 auto complete wrong for ruby do block
The auto complete for my ruby do blocks in SublimeText2 started auto completing this:
downto(0) { nnn } instead of do..end. I have not changed any settings recently so I am at a bit of a loss.
0
votes
4answers
27 views
Template is Missing Error
I am trying to run a simple blog post at localhost:3000/posts.
When I try to access the page, I receive this error.
Template is missing
Missing template posts/index, application/index with ...
1
vote
0answers
19 views
Route not found when using Devise's devise_scope
I am using devise for authentication in my app. My routes file look like this:
devise_scope :user do
get "/password_reset" => "devise/passwords#new", :as => "new_user_password"
post ...
1
vote
1answer
13 views
git push heroku master issue
I am having a problem with my application not being uploaded to heroku. When I typed in:
git push heroku master
I get an error at the end:
**Results logged to ...
1
vote
0answers
19 views
Rails Project on EC2
I have successfully deployed rails project on EC2.
Here are the steps:
Clone rails project from github
Set up database and database.yml
Run rake db:migrate
Run rake assets: precompile
Start rails ...
0
votes
1answer
29 views
How to include lib directory in rspec tests
I am having a problem in testing my gem which includes a lib directory, on JRuby 1.7.4.
I want to test a file located at lib/vger/resources/account_manager.rb
class Vger::Resources::AccountManager
...
1
vote
0answers
8 views
Requirements OS X Brew libs install error
I am trying to make a clean install from RVM to my MacBook and I have a lot of work with the RVM requirements. I started to install separately, but I have this error:
$ rvm requirements
Installing ...
2
votes
2answers
31 views
How to get path of instance?
I want to design a class as below:
class A
@@instances ||= []
attr_reader :path, :name
def initialize name
@name = name
@path = # I don't know how to get the path of ...
1
vote
5answers
33 views
Can't fill hash in Ruby on Rails controller
I am working on an application and I need to fill in a hash with empty values if it does not already have values. @pet[] contains 3 hashes, each should have a :name, :age and :pet_type_id. The ...
0
votes
1answer
15 views
Ruby on Rails: Linking to resource show page results in No Route Matches
I have been working on my first project in rails and have stumbled across a problem while using tags. I have it working so when the user clicks a tag it shows all entries associated with that tag. ...