[Rails] About ActiveRecord#locking_column

2018-03-09 Thread UG Aimerald
I doubt that the model that inherited ActiveRecord will return lock_version 
even if it does not have locking_column (lock_version etc.).
Please let me know if anyone knows why such an implementation is in place.
If there is no reason I will make a PR to fix

-- 
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+unsubscr...@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/724c526b-66c4-43b9-b4ea-9aad13d9f2dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] How can I get this create_table statement on one line?

2018-03-09 Thread Hassan Schroeder
On Fri, Mar 9, 2018 at 12:42 AM, Robert Phillips
 wrote:

> I can't get a create_table statement onto one line
>
> irb(main):019:0> ActiveRecord::Migration.create_table :wers { |t| t.string
> :name }
> SyntaxError: (irb):19: syntax error, unexpected '{', expecting end-of-input
> Migration.create_table :wers { |t| t.string :name }

ActiveRecord::Migration.create_table(:wers){ |t| t.string :name }
-- create_table(:wers)
   (60.1ms)  SET NAMES utf8,  @@SESSION.sql_mode =
CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'),
',NO_AUTO_VALUE_ON_ZERO'),  @@SESSION.sql_auto_is_null = 0,
@@SESSION.wait_timeout = 2147483
   (192.1ms)  CREATE TABLE `wers` (`id` bigint NOT NULL AUTO_INCREMENT
PRIMARY KEY, `name` varchar(255)) ENGINE=InnoDB
   -> 0.4446s
=> nil
2.5.0 (main):0 >

You need to separate the argument ":wers" from the block with parens.

HTH!
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

-- 
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+unsubscr...@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/CACmC4yBZ_EHZ_WPNjD5kuK6OCA62SKH0XJudsjphBmOCfgFjdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Why ApplicationRecord

2018-03-09 Thread Aboobacker M K
You can find rationale from original PR which introduced this feature
https://github.com/rails/rails/pull/22567


On Fri, Mar 9, 2018 at 8:28 PM, fugee ohu  wrote:

> Why create an ApplicationRecord class inheriting from ActiveRecord::Base
> and then have all models  inherit from ApplicationRecord instead of
> ActiveRecord::Base ?
>
> --
> 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+unsubscr...@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/25c8ec85-1ec8-4740-8d27-
> a55a1461b038%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Regards


Aboobacker MK

Software Developer | Red Panthers | Engineering

phone: 8289976088
site: aboobacker.in
skype: aboobac...@redpanthers.co

-- 
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+unsubscr...@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/CAP3AYfa%3D-eYFLwNC%2Bk%3Db_ZtqpSTeybcpZAuZKah5wWWBKJ%3Dmkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Why ApplicationRecord

2018-03-09 Thread fugee ohu
Why create an ApplicationRecord class inheriting from ActiveRecord::Base 
and then have all models  inherit from ApplicationRecord instead of 
ActiveRecord::Base ?

-- 
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+unsubscr...@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/25c8ec85-1ec8-4740-8d27-a55a1461b038%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: /app/helpers/url_helpers.rb

2018-03-09 Thread André Orvalho
Dude you really need to read a book or learn how to start using google. You 
ask every single question of the most simple usage of the framework.

You can learn here: http://bit.ly/2tvfGTT

-- 
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+unsubscr...@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/68d199af-3754-48e6-a4d1-a9bcdf761259%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: I Love Ruby updated - the free Ruby programming book

2018-03-09 Thread Gerald Bauer
Hello,
   Just published the talk notes from Vienna.rb on "Build (Online)
Books and Documentation w/ Octobook Themes and the Jekyll (Static)
Website Compiler" [1].

  The agenda reads:

   - What's a Jekyll Theme?
   - What's Dr Jekyll's?
  - Jekyll Themes 'n' GitHub Pages
  - What's the Jekyll Remote Theme Plugin
- Jekyll Remote Theme In Action Example - Ruby Habits
  -   What's Octobook?
  - Three Octobook Real-World Examples
 1. World Classics
 2. Project Documentation
 3. Yuki & Moto Press Bookshelf


   Any interest in publishing the source for your I Love Ruby book in
markdown? And publishing a web version on GitHub Pages (with a ruby
tool chain eg. jekyll, kramdown, github pages, octobook, etc.)?

   Cheers. Prost.

[1] https://github.com/geraldb/talks/blob/master/octobook.md

2018-03-09 7:27 GMT+01:00 Karthikeyan A K <77mi...@gmail.com>:
> Hello Folks,
>
> I added a section for test driven development. You can download I Love Ruby
> here https://mindaslab.github.io/I-Love-Ruby/
>
> Enjoy coding.
>
> --
> Karthikeyan A K
> Author of https://mindaslab.github.io/I-Love-Ruby/
>
>
> Unsubscribe: 
> 
>

-- 
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+unsubscr...@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/CAAxEZd95sbiOtqykybo3Vws19MwdrbADhgqo79Ly_G1m4JOO2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] How can I get this create_table statement on one line?

2018-03-09 Thread Robert Phillips
If I go to rails console

I can't get a create_table statement onto one line

irb(main):019:0> ActiveRecord::Migration.create_table :wers { |t| t.string 
:name }
SyntaxError: (irb):19: syntax error, unexpected '{', expecting end-of-input
Migration.create_table :wers { |t| t.string :name }



I can see this works

irb(main):032:0> 5.times do |r|
irb(main):033:1* puts "a"
irb(main):034:1> end

and this works

irb(main):031:0> 5.times { |r| puts "a"}


And I can see this works

irb(main):039:0> ActiveRecord::Migration.create_table :haae do |t|
irb(main):040:1* t.string :firstname
irb(main):041:1> end
-- create_table(:haae)
   (4.0ms)  CREATE TABLE "haae" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT 
NULL, "firstname" varchar)
   -> 0.0057s
=> []
irb(main):042:0>


But I still can't get that create_table line onto one line


irb(main):019:0> ActiveRecord::Migration.create_table :wers { |t| t.string 
:name }
SyntaxError: (irb):19: syntax error, unexpected '{', expecting end-of-input
Migration.create_table :wers { |t| t.string :name }

I was able to replace the do and end on the 5.times line.. with {..}  and 
put it on one line, but I can't get the same to work for create_table 

I'm ok with putting it on multiple lines but I like the flexibility of 
being able to put it on one line should I so wish

Thanks

-- 
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+unsubscr...@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/c0a8e0c3-8640-4574-899a-2eed0a0102f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.