Ruby on Rails Wednesday, January 28, 2015

After running a migration I noticed that rails is changing the specified
decimal data type in PostgreSQL. Is there a reason for that?

According to this post:
http://stackoverflow.com/questions/1841915/difference-betweeen-decimal-and-numeric
I found that there is a slight difference between decimal type and
numeric type:


NUMERIC must be exactly as precise as it is defined — so if you define 4
decimal places, the DB must always store 4 decimal places.

DECIMAL must be at least as precise as it is defined. This means that
the database can actually store more digits then specified (due to the
behind-the-scenes storage having space for extra digits). This means the
database might store 1.00005 instead of 1.0000, affecting future
calculations.


class CreateBooks < ActiveRecord::Migration
def change
create_table :books, id: :uuid do |t|
t.decimal :price
t.string :title
t.timestamps
end
end
end

After running this migration, the column price is of numeric type
instead of decimal.

Any feedback is appreciated

Rod

--
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@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/15138c4c6b5b53e9b4c568f146787d06%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails


/usr/local/rvm/gems/ruby-2.1.2/gems/execjs-2.2.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

for this error check http://stackoverflow.com/questions/9202324/execjs-could-not-find-a-javascript-runtime-but-execjs-and-therubyracer-are-in - the solution varies depending on your operating system

--
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@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/dcdecf74-bbba-45aa-ba92-53f37761f268%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On 28 January 2015 at 05:04, Nanduchocom <gerencia@nanducho.com> wrote:
> Excusme, i don't know if you see the message error:

Which error? Your original error message should no longer appear if
you have followed the earlier suggestions.

Probably the best way to ensure you are using the correct ruby version
in your app is to put a .ruby-version file in the top level of the
application, containing the ruby version number that you want to use
for that app.

Colin

--
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@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLv7Ueh-0X3weXBJcxBL50T4NTkJOCkp1nf4b7ErFW0LVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.