Re: [Rails] I have issue in Rails Server

2016-12-02 Thread Furqan Ahmad
C:\Sites\demo_app>rails s
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.12/lib/sqlite3.
rb:6:in `require': 126: The specified module could not be found.   -
C:/RailsIns
taller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.12/lib/sqlite3/sqlite3_nat
ive.so (LoadError)
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.12
/lib/sqlite3.rb:6:in `rescue in '
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.12
/lib/sqlite3.rb:2:in `'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:91:in `require'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:86:in `each'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:86:in `block in require'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:75:in `each'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler/runtime.rb:75:in `require'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6
/lib/bundler.rb:106:in `require'
from C:/Sites/demo_app/config/application.rb:7:in `'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0
.1/lib/rails/commands/commands_tasks.rb:88:in `require'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0
.1/lib/rails/commands/commands_tasks.rb:88:in `block in server'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0
.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0
.1/lib/rails/commands/commands_tasks.rb:85:in `server'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0
.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0
.1/lib/rails/commands.rb:18:in `'
from bin/rails:4:in `require'
from bin/rails:4:in `'

C:\Sites\demo_app>


here is the code sir and like here i am pointing to my demo_app and than
run the rails server and again it shows this message

On 3 December 2016 at 02:57, Colin Law  wrote:

> On 2 December 2016 at 21:46, Furqan Ahmad  wrote:
>
>> First the code was not copy from cmd or may be i don't know how to copy
>> from there and second of all yes there are 3 to 4 apps are there
>>
>
> First, on Ubuntu to copy from the terminal use Ctrl+Shift+C, I don't know
> whether this works on Windows but I am sure that if it does not then google
> will tell you how to do it.
>
> Second you cannot have 3 to 4 apps in one folder, you can have apps in
> sub-folders of Sites, but you must run the server in the folder that is the
> root of the app, that is the folder that contains the subfolders app,
> config, db etc.  The server only runs one rails app at a time.
>
> Colin
>
>
>
>>
>> On Dec 3, 2016 2:43 AM, "Colin Law"  wrote:
>>
>>> On 2 December 2016 at 18:26, Furqan Ahmad  wrote:
>>>

 

 it was worked fine before i installed sqlite3 by this method
 Install the Ruby Devkit for your setup 
 (DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
 for me since I use a x64 machine)
 Download and extract the autoconf package from Sqlite.org
 Run msys.bat (it is inside the ruby devkit root folder)
 cd into the path where you downloaded the sqlite source (for example:
 "cd /c/dev/sqlite3" for path "c:\dev\sqlite3" if you are new to
 MSYS/MINGW32)
 Run "./configure"
 Run "make"
 Run "make install"
 Get the sqlite3 gem again, this time specifying the platform and the
 path to the newly compiled binaries:


 

 Now when i run rails server it shows me this instead of running the
 server

>>>
>>> It is usually better to copy/paste this type of error rather than
>>> posting an image. When running rails s you must be in the root folder of a
>>> rails app, is there an app in c:\Sites?
>>>
>>> Colin
>>>
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Ruby on Rails: Talk" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/rubyonrails-talk/hwoahvJG2mU/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> 

Re: [Rails] I have issue in Rails Server

2016-12-02 Thread Colin Law
On 2 December 2016 at 21:46, Furqan Ahmad  wrote:

> First the code was not copy from cmd or may be i don't know how to copy
> from there and second of all yes there are 3 to 4 apps are there
>

First, on Ubuntu to copy from the terminal use Ctrl+Shift+C, I don't know
whether this works on Windows but I am sure that if it does not then google
will tell you how to do it.

Second you cannot have 3 to 4 apps in one folder, you can have apps in
sub-folders of Sites, but you must run the server in the folder that is the
root of the app, that is the folder that contains the subfolders app,
config, db etc.  The server only runs one rails app at a time.

Colin



>
> On Dec 3, 2016 2:43 AM, "Colin Law"  wrote:
>
>> On 2 December 2016 at 18:26, Furqan Ahmad  wrote:
>>
>>>
>>> 
>>>
>>> it was worked fine before i installed sqlite3 by this method
>>> Install the Ruby Devkit for your setup 
>>> (DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
>>> for me since I use a x64 machine)
>>> Download and extract the autoconf package from Sqlite.org
>>> Run msys.bat (it is inside the ruby devkit root folder)
>>> cd into the path where you downloaded the sqlite source (for example:
>>> "cd /c/dev/sqlite3" for path "c:\dev\sqlite3" if you are new to
>>> MSYS/MINGW32)
>>> Run "./configure"
>>> Run "make"
>>> Run "make install"
>>> Get the sqlite3 gem again, this time specifying the platform and the
>>> path to the newly compiled binaries:
>>>
>>>
>>> 
>>>
>>> Now when i run rails server it shows me this instead of running the
>>> server
>>>
>>
>> It is usually better to copy/paste this type of error rather than posting
>> an image. When running rails s you must be in the root folder of a rails
>> app, is there an app in c:\Sites?
>>
>> Colin
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ruby on Rails: Talk" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/rubyonrails-talk/hwoahvJG2mU/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/ms
>> gid/rubyonrails-talk/CAL%3D0gLt1GggKCLY5MDkeDMh6VjWJ%2BOumz5
>> PW5BWmJg4VB1u4-Q%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/CAKY0HLDwKjvDVDuRvD-GDgB%
> 2BGNutLy0GNGvMLbaES_RNe_YFmg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAL%3D0gLtcbrgBbgWL1k1eggawJFe4VZ4A-xy3eeyBV02Sprhj%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Is the test database cleared after each test?

2016-12-02 Thread Colin Law
On 2 December 2016 at 16:57, 'krfg' via Ruby on Rails: Talk
 wrote:
> Some of my tests would not pass if the test database was not cleared after
> the previous tests.
> For instance my application, based on the Michael Hartl's tutorial, gives
> users the opportunity to create an association between two users.
> The web interface is configured to use or not use Ajax.
> There are usually two tests, one for Ajax and the other for standard html
> requests, and both of them check that the association between the same two
> users user1 and user2 was created by counting the number of user1
> relationships, that should be increased by 1. Now user1 could not create
> twice the same association with user2, unless that association was cleared
> after the first test. Is that so?
> If this is Rails behaviour, which I only guess is such because I could not
> find documentation about it, I would rely on this for all my future tests.
> In particular I would like to test a background job that populates my
> database by counting that the number of saved records (100) is correct as
> expected.
> If the database is cleared after this test I could re run the test and I
> would still count 100 records.
> If the database is not cleared, the second time I run the test I would count
> 200 records, so the test would fail.

The default is that the database will be rolled back between tests. If
you look in test.log you will the rollbacks happening.

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+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/8ad94737-79e0-46d7-ba7c-a616b3e4dc08%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAL%3D0gLu7cZfyL50zzRSL1Hwq3RBc5ej9MKsvrVVN4%2BEqR%2BOZWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] I have issue in Rails Server

2016-12-02 Thread Furqan Ahmad
First the code was not copy from cmd or may be i don't know how to copy
from there and second of all yes there are 3 to 4 apps are there

On Dec 3, 2016 2:43 AM, "Colin Law"  wrote:

> On 2 December 2016 at 18:26, Furqan Ahmad  wrote:
>
>>
>> 
>>
>> it was worked fine before i installed sqlite3 by this method
>> Install the Ruby Devkit for your setup 
>> (DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
>> for me since I use a x64 machine)
>> Download and extract the autoconf package from Sqlite.org
>> Run msys.bat (it is inside the ruby devkit root folder)
>> cd into the path where you downloaded the sqlite source (for example: "cd
>> /c/dev/sqlite3" for path "c:\dev\sqlite3" if you are new to MSYS/MINGW32)
>> Run "./configure"
>> Run "make"
>> Run "make install"
>> Get the sqlite3 gem again, this time specifying the platform and the path
>> to the newly compiled binaries:
>>
>>
>> 
>>
>> Now when i run rails server it shows me this instead of running the server
>>
>
> It is usually better to copy/paste this type of error rather than posting
> an image. When running rails s you must be in the root folder of a rails
> app, is there an app in c:\Sites?
>
> Colin
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/rubyonrails-talk/hwoahvJG2mU/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAL%3D0gLt1GggKCLY5MDkeDMh6VjWJ%
> 2BOumz5PW5BWmJg4VB1u4-Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAKY0HLDwKjvDVDuRvD-GDgB%2BGNutLy0GNGvMLbaES_RNe_YFmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] I have issue in Rails Server

2016-12-02 Thread Colin Law
On 2 December 2016 at 18:26, Furqan Ahmad  wrote:

>
> 
>
> it was worked fine before i installed sqlite3 by this method
> Install the Ruby Devkit for your setup 
> (DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
> for me since I use a x64 machine)
> Download and extract the autoconf package from Sqlite.org
> Run msys.bat (it is inside the ruby devkit root folder)
> cd into the path where you downloaded the sqlite source (for example: "cd
> /c/dev/sqlite3" for path "c:\dev\sqlite3" if you are new to MSYS/MINGW32)
> Run "./configure"
> Run "make"
> Run "make install"
> Get the sqlite3 gem again, this time specifying the platform and the path
> to the newly compiled binaries:
>
>
> 
>
> Now when i run rails server it shows me this instead of running the server
>

It is usually better to copy/paste this type of error rather than posting
an image. When running rails s you must be in the root folder of a rails
app, is there an app in c:\Sites?

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+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/CAL%3D0gLt1GggKCLY5MDkeDMh6VjWJ%2BOumz5PW5BWmJg4VB1u4-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Is the test database cleared after each test?

2016-12-02 Thread 'krfg' via Ruby on Rails: Talk
I will have a look at database_cleaner.
Many thanks for your suggestion.

-- 
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/4a943e2f-cb07-4527-9342-f0794dd2eed5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] I have issue in Rails Server

2016-12-02 Thread Furqan Ahmad




it was worked fine before i installed sqlite3 by this method
Install the Ruby Devkit for your setup 
(DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe for me since I use a x64 
machine)
Download and extract the autoconf package from Sqlite.org
Run msys.bat (it is inside the ruby devkit root folder)
cd into the path where you downloaded the sqlite source (for example: "cd 
/c/dev/sqlite3" for path "c:\dev\sqlite3" if you are new to MSYS/MINGW32)
Run "./configure"
Run "make"
Run "make install"
Get the sqlite3 gem again, this time specifying the platform and the path 
to the newly compiled binaries:



Now when i run rails server it shows me this instead of running the server

-- 
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/8868ec7e-33ce-40db-b3f4-c1641f26dae6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Is the test database cleared after each test?

2016-12-02 Thread Dave Aronson
On Fri, Dec 2, 2016 at 12:56 PM, 'krfg' via Ruby on Rails: Talk
 wrote:
> On Friday, December 2, 2016 at 6:45:12 PM UTC+1, Dave Aronson wrote:
>>
>> The important thing is that every test start from a *known state*.
>> The easiest state to achieve and reason about, is empty.
>
> And what is Rails' default behaviour?
> I only guess that it empties all tables after each test, but this is only my
> guess.

I'm not sure but I think it rolls back changes (i.e., the transaction
each test is wrapped in) after each test.  Or that may be dependent on
what db and/or test framework you're using; I don't think it's even
possible with SQLite, but I usually use PostgreSQL.  Anyway, I've
usually used the database-cleaner gem
(https://github.com/DatabaseCleaner/database_cleaner) rather than rely
on whatever Rails chooses to do.  Check it out; there may be a
configuration that meets your needs.  Avdi Grimm also wrote a good
blog post on it long ago that I remember finding very helpful.

-Dave

-- 
Dave Aronson, consulting software developer of Codosaur.us,
PullRequestRoulette.com, Blog.Codosaur.us, and Dare2XL.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+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/CAHxKQijbdef1iwMoiD5wqZJENkXptCzj5YyatOLC9gv%3Dags-CA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Is the test database cleared after each test?

2016-12-02 Thread 'krfg' via Ruby on Rails: Talk
On Friday, December 2, 2016 at 6:45:12 PM UTC+1, Dave Aronson wrote:
>
>
> The important thing is that every test start from a *known state*. 
>
The easiest state to achieve and reason about, is empty.
>

And what is Rails' default behaviour?
I only guess that it empties all tables after each test, but this is only 
my guess.

-- 
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/fd3f41b3-6edd-4b01-8f43-20c664914564%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Is the test database cleared after each test?

2016-12-02 Thread Dave Aronson
On Fri, Dec 2, 2016 at 11:57 AM, 'krfg' via Ruby on Rails: Talk
 wrote:

> Some of my tests would not pass if the test database was not cleared after
> the previous tests.

The important thing is that every test start from a *known state*.
The easiest state to achieve and reason about, is empty.  It also
forces you to be more explicit within your tests (or their
setup/before blocks) about any records you're adding in support of the
test.

But, if you want to start from a known *populated* state, that's a
pretty common approach too.

Either way, though, you need to clean up any changes each test makes.
With a populated start state, you can do each test in a transaction
and roll it back, which assumes you're using a DBMS that supports
that.  With an empty state, you can do that, *or* truncate the tables,
or various other options.

-Dave

-- 
Dave Aronson, consulting software developer of Codosaur.us,
PullRequestRoulette.com, Blog.Codosaur.us, and Dare2XL.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+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/CAHxKQijfoxdJ-CkEL7ZkZVpZHLy%2B7Z8wbKuC5_i6ZctMBMCjLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Is the test database cleared after each test?

2016-12-02 Thread 'krfg' via Ruby on Rails: Talk
Some of my tests would not pass if the test database was not cleared after 
the previous tests.
For instance my application, based on the Michael Hartl's tutorial, gives 
users the opportunity to create an association between two users.
The web interface is configured to use or not use Ajax.
There are usually two tests, one for Ajax and the other for standard html 
requests, and both of them check that the association between the same two 
users user1 and user2 was created by counting the number of user1 
relationships, that should be increased by 1. Now user1 could not create 
twice the same association with user2, unless that association was cleared 
after the first test. Is that so?
If this is Rails behaviour, which I only guess is such because I could not 
find documentation about it, I would rely on this for all my future tests.
In particular I would like to test a background job that populates my 
database by counting that the number of saved records (100) is correct as 
expected.
If the database is cleared after this test I could re run the test and I 
would still count 100 records.
If the database is not cleared, the second time I run the test I would 
count 200 records, so the test would fail.

-- 
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/8ad94737-79e0-46d7-ba7c-a616b3e4dc08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.