Error when creating new app with rails - ruby-on-rails

I installed rails on windows with RailsInstaller and when i try to create a new application with command e.g.
rails new blog
it creates a lot of files but after it Using turbolinks 2.2.2 it returns an error to me:
Bundler::GemspecError: Could not read gem at C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/cache/tzinfo-data-1.2014.3.gem. It may be corrupted.
How can i solve the problem?

It looks like you have a corrupted gem file (maybe due to network download issue).
Go to C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\cache\ and delete the file called tzinfo-data-1.2014.3.gem.
Then run the rails new blog command again and it should work.

Related

Rails Generate model error in Ruby on Rails

I am building a new RoR app and i had tried to create a new model like below.
rails generate model Pic title:string description:text
But I keep on getting these errors always and I tried installing many methods like installing gems ,updated the gems etc.
P.S : I am trying install the older version of the gems. Is that creating a problem?
But none of it gave me the results. Please help me with this.
P.P.S : I am an absolute beginner to ruby. So please help me by giving solution with good reason. Thanks in Advance.
Hi seems like you have issues with your simple_form gem,try to remove from gem file and add gem 'simple_form' and run bundle install after this step run rails generate simple_form:install for creating config file for simple form.
Try this it may help you out.
As #Navneet pointed out generating a config file can also be used for configuration and it also works pretty well.
Another thing i found was , Here the gems used were older version. That created a compatibility issue(since it was not configured accordingly). So by replacing the gems with current version or stable ones , you can get rid of this problem.
Go to rubygems.org
Search for the gems and check whether its the latest version
If not, Replace the line of corresponding gem in Gemfile with newest one.

"rails new [Blah]" No such file

So I'm new to Ruby and also to Rails. I have recently installed Ruby on Arch Linux.
It was mostly all fine any happy except for a few errors here and there but now when I try initializing a new rails app using rails new AppName I get the error
bash: /home/[username]/.gem/ruby/2.3.0/bin/rails: No such file or directory
I've tried creating a file and directory called rails in but get more errors.
reinstalling rails same outcome
reinstalling ruby same outcome
following any other dependencies at install also leads no wear.
Ask for any info you may need.
Thanks in advance
UPDATE
installing of gems is now stopped by a common error
$ gem install rails
Building native extensions. This could take a while...
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /usr/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out
and the same when I try install nokogiri
ok first check that you installed both ruby and rails well
ruby -v
and
rails -v
so if you get a respond to that you're all good
go to the place you want to create your folder att
rails new appname
then
cd appname
if that doesn't work try to generate anything
rails generate controller appname
if the generate works then your rails is ok if not then you might want to add the rails to your environment variable path.
You installed ruby on your computer. However the path is not recognized yet on it. To add it you can do this . if you are using windows my computer right click and then chose advanced system settings -> advanced at the bottom environment variables system variables PATH and then add the the path to your ruby bin folder. I am sorry i don't have enough reputation so can't add pictures but reading this will solve your problem
The overall problem is a lack of permissions to /usr/lib/ruby/. This can be fixed with
sudo chmod 777 /usr/lib/ruby

Can't get Ruby on Rails to work on Windows 7

This is a follow up to an earlier quesiton. I just installed Ruby on Rails using the rails installer (www.railsinstaller.org) but when I try to run any commants be it gem -v or rails new sample I get an error message saying:
Failed to load C:/Users/Zack/.gemrc due to permissions problem.
ANY ideas what to do would be very much appreciated. (Note that this is all being run on windows 7).
Was this just the only error you received in the console? Also have you checked if this file exists in the directory it is pointing to. if so what is in it. If you happen something like the following in the .gemrc you should have something like the following:
"gem": "--no-ri --no-rdoc"
This should work, providing this file exists. This can be caused when you installed Ruby using admin and then the file is created. For supported information check the following SO question this may also support you Ruby gem listed, but wont load
Probably there are two files .gemrc like in C:/Users/Zack/.gemrc and C:/ProgramData/gemrc/.gemrc. Verify and delete this last.

Ruby on Rails -Sqlite3 procedure could not be located in the dynamic link library sqlite3 dll

I am new to Ruby on rails and have just previously asked a question about the script/server not being created. And found out that it's because of the sqlite not found. So I installed the gem and that's not working either, it was saying that the .dll wasn't found. So I used this quite tutorial to get the .dll and placed it in my /ruby/bin.
That fixed the .dll missing issue but has caused another problem. When I try to start the server (rails server), it says:
The procedure entry point
sqlite_column_database_name could not
be located in the dynamic link library
sqlite3.dll
Please help, I am a noob at this Ruby on Rails stuff :/
Run "gem list sqlite". Post the output.
I suspect you installed sqlite-ruby instead of sqlite3 gem. The old gem is trying to call an old function in the dll that doesn't exist anymore.
If you don't see "sqlite3" in your gem list, run "gem install sqlite3".

Where does rails source file locate?

Hey guys
I'm new to rails, I read something about reading source code is good way to study rails, and I found the related rb file in rails' online document, such as this page
But I can't find where the rails source file locate in my mac, could someone to help me out?
Easiest way is to look online at the github repo
If you want to browse it locally, you can (depending on your version of rails) to a bundle show rails for Rails 3.0, this will tell you where it's installed.
For rails 2.3.x you just need to find out where the gem is installed and open that up. If you're using RVM for instance it will be somewhere in ~/.rvm

Resources