Displaying 20 results from an estimated 60000 matches similar to: "Confusion with method call without `.` operator"
2013 Aug 27
11
Why NaN.class throws NameError ?
Here is my sample code:
class Foo
Bar = 10
end
Foo::Bar # => 10
Foo::Bar.class # => Fixnum
10.class # => Fixnum
Float::NAN # => NaN
Float::NAN.class # => Float
NaN.class
# uninitialized constant NaN (NameError)
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
2013 Jun 21
7
IRB help
I''m new to Ruby. I installed Rails on Windows 8.
When I type mkdir in IRB, I''m getting this. I tried running the IRB as
administrator too, and still get the same result
irb(main):001:0> mkdir lesson2
NameError: undefined local variable or method `lesson2'' for main:Object
from (irb):1
from C:/RailsInstaller/Ruby1.9.3/bin/irb:12:in
2012 Sep 12
8
Round off method in 1.8.7
Hi all
i am trying to use round method if have a value 2.08 i want it as 2.1 and
it worked in 1.9.2 but not in 1.8.7 is there any other way of doing it.
USING 1.9.2
1.9.2p320 :001 > 2.08.round(1)
=> 2.1
1.9.2p320 :002 > 2.04.round(1)
=> 2.0
USING 1.8.7
irb(main):001:0> 2.08.round
=> 2
irb(main):002:0> 2.08.round(1)
ArgumentError: wrong number of arguments (1 for
2013 Oct 27
5
run simple method from Helper on button click
Greetings,
I''m new to rails and currently having couple problems about how to add
javascript functionality into rails.
I have a simple method in the helper and i want to run this code on
button click.
------------------------------------------------------------------
module PagesHelper
def show_message
"simple output"
end
end
2013 Jul 19
12
Rails 4 "belongs_to: record" association doesn't work
Hi,
I discovered a weird behavior when using a "belongs_to: record" association
in Rails 4.
Given two models A and B:
class A < ActiveRecord::Base
belongs_to :record, class_name: ''B'', foreign_key: ''b_id''
end
class B < ActiveRecord::Base
end
When creating A, it inserts a record in B and returns A with id of nil:
irb(main):001:0>
2013 Sep 02
2
Why the string interpolation is not working inside the Nokogiri method `#search` ?
Why the string interpolation is not working inside the Nokogiri method
`#search` ?
require ''nokogiri''
doc = Nokogiri::HTML::Document.parse <<-eotl
<div>
<p>foo</p>
<p>foo</p>
<p>bar</p>
</div>
eotl
doc.class # => Nokogiri::HTML::Document
class Person
attr_accessor :name
end
ram = Person.new
2013 Aug 29
2
Need a bit help on "module_function" method
The documentation is very straight forward and the mentioned example
also cleared all the lines except the one mentioned inside **.
http://ruby-doc.org/core-2.0.0/Module.html#method-i-module_function
Creates module functions for the named methods. These functions may be
called with the module as a receiver, and also become available as
instance methods to classes that mix in the module. Module
2013 Jun 04
3
Nokogiri::XML methods example
Hi,
I am not able to find out a simple example to find out the how the
method works:
> Nokogiri::XML::EntityReference::new
(http://nokogiri.org/Nokogiri/XML/EntityReference.html#method-c-new)
> Nokogiri::XML::Document#canonicalize
(http://nokogiri.org/Nokogiri/XML/Document.html#method-i-canonicalize)
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received this message
2013 Jun 21
3
[HELP ] Call java code / method from Ruby programming
Hi All ,
I have written java code ( This java code will not return any thing but
it will do action ) which is required call from ruby , please let me what
is best way to achieve this ?
Thanks ,
Muthu Selvan SR
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from
2013 Jun 02
16
Ruby 2.0 is running, but Rails 4 doesn't see it.
What am I doing wrong??
****@ubuntu:~/ruby/things_i_bought$ rake db:migrate
Rails 4 prefers to run on Ruby 2.0.
You''re running
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
Please upgrade to Ruby 1.9.3 or newer to continue.
****@ubuntu:~/ruby/things_i_bought$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]
****@ubuntu:~/ruby/things_i_bought$ rvm
2012 Nov 09
8
method conditional option pattern
When I have this pattern
sign_me(@user, :event => :authentication, :subdomain => subdomain)
how can I write it to avoid sending the :subdomain option if subdomain.nil?
( if possible ..)
sign_me(@user, :event => :authentication #?, :subdomain =>
subdomain unless subdomain.nil? )
--
You received this message because you are subscribed to the Google Groups
2013 Aug 29
10
Concatenate two arrays
Hello again ruby community!
I just learned how to add two arrays(I know, i know).
My program looked like this
array1=[1,2,3]
array2=[4,5,6]
array_sum=array1+array2
I thought pretty simple stuff, they are combined. However, now i am
looking to define that code as a method and I do not understand how to
create the correct number of arguments, so when the method is called
back it gives me my
2013 Sep 20
3
having problem to install the gem `mysql`
I am having problem to install the gem `mysql`.
kirti@kirti-Aspire-5733Z:~$ gem install mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/home/kirti/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
checking for mysql_query()... -lmysqlclient
checking for main() in -lm... yes
checking for mysql_query()...
2013 May 31
11
A simple javascript alert not working
If I have a file in view /test called index.js.erb and in it a simple
alert("hello") shouldn''t that run when I go to /test/index? It doesn''t.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it,
2013 Jul 25
3
User Role authorisation
Hello, Currently I am working on a app, so far I have User (with devise)
which are able to create projects. So, if user1 creates project A and
project B I want him, to be able to assign user2 with role admin on
project A, and user2 with moderator role on project B. I was thinking in
creating a UserRoleProject link table, is it a good idea? Or if not
please help me with some pointers.
The action
2013 Jul 09
3
routes for devise in rails4
hi all,
i am using 3 devises for 3 models in rails4.
i need routes to my devise models.the devises are client,admin,employee.
when i login into client then it will go to clients dashboard, when i
login into admin then it will go to admins dashboard, the employee also
has the employee dashboard.
if i do not enter any login then the common dashboard body message is
please signin.
please let me
2013 Jul 05
7
how to use single login page for users in four models
how to use single login page for users in four models
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group,
2013 May 29
5
Can't setup Rails with RVM in ubuntu 12.04
I''m doing setu Ruby on Rails with RVM.
I had setup ruby 1.9.3 p429 and RVM,RubyGem... succesfully
But I can''t setup Rails with command : gem install rails because of
error:
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: rails requires activesupport (=
3.2.13), actionpack (= 3.2.13), activerecord (= 3.2.13), activeresource
(= 3.2.13),
2013 Aug 29
4
Weird behaviour using ssl connection (OpenSSL::SSL::SSLError)
Hi guys
when I execute the piece of code bellow on RoR console it works fine:
url = URI.parse("https://us1.api.mailchimp.com/2.0/helper/ping")
request = Net::HTTP::Post.new(url.path)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request.body = "{\"apikey\": \"myapikey\"}"
response = http.start
2013 Sep 26
4
Rails Misconfigured - Missing Welcome Page
I''m using DigitalOcean as my hosting provider as I have some simple
sites there. I thought I''d try to setup rails on a domain there to see
what I could accomplish.
OS: Ubuntu 12.04 x32
Rails: 4.0.0
Ruby: 2.0.0p247
nginx: 1.1.19
MariaDB: 10.0.4
Passenger: 4.0.19
node.js: 0.6.12
Thin: 1.5.1
When I hit the sight, I get "Welcome to