I'm very new to rails and have been trying to experiment with using Mongodb on a web app.
I have been following this railscast tutorial here word for word and have been running into issues with it not connecting to my local Mongodb.
I'm sure Mongodb is up and running since mongod shows up in my activity monitor and going to
http://localhost:28017/
shows:
http://imgur.com/KJ0JI.png
The problem is when I go to 0.0.0.0:3000/projects/new and try to add a new project name,
this comes up:
http://imgur.com/yxRwC.png
Here is my output when running script/server:
http://imgur.com/A9JTE.png
On my other apps, I have been using sqlite and haven't been having any issues.
I tried uninstalling mongodb and running it anyways for testing purposes and I get
the exact some issue. I guess Mongodb simply isn't being detected through rails and MongoMapper.
Anyone have any idea how to fix this thing?
I spent many hours trying to fix this and resorted to getting a stackoverflow account
and asking on here.
Let me know if there's anything else anyone needs to possibly help diagnose the problem.
Any help would be appreciated.
note: sorry, since I'm new, I can't post pictures of the errors.
I hope you can take the time to view them on imgur
Related
I tried to reload rails environment with the reload! command, I think it might be depracated. Does anyone know the modern way of reloading the rails environment? This book is available free for download, Im on page 79, it's Michael Hartl's "RailsSpace: Building a social networking website with ruby on rails", published in 2007, several people suggested that I give up on the book already, I just wanted to make sure it wasn't a modern way of doing things before I gave up on the book. So many experts on stackoverflow helped me get through the book already, I decided to take my chances.
Here is a link to the book: https://pdfs.semanticscholar.org/ca98/3b5098cd5957dc1842bb4bf3175406624bca.pdf?_ga=2.121598472.1814901715.1569094472-1963651489.1569094472, its one of the only FREE sources out there for building a social media website thats why I cant give up on it so easily, even though it was published in 2007 and its a bit outdated. Plus I just want to see what stackoverflow can do for me before I just give up on the book. So many experts on stackoverflow helped me make it this far, Im curious to find out if I can get through the entire book with stackoverflow. If anyone knows a better source that's free, please send me a link. Right now page 79, is the roadblock, its that reload! command that might be depracated. Maybe its an expert on stackoverflow that knows the knew command for it. If that's you please help. I already tried googling it, it took me straight here to stackoverflow lol. I decided to post a question of my own, that other guy's question doesn't seem to match mine so here I am. Please help if you can.
Within the Rails console (rails c, or more formally bundle exec bin/rails c) you should be able to run:
reload!
That reloads the active environment, specifically anything within app/ and config/routes.rb, but other things will not be reloaded until you exit and restart the console. This has always been the case.
Note that this is only within the Ruby interactive environment, as in you'll have a prompt that looks like this:
irb(main):001:0>
If you see something else you may not be in the Rails console and are trying to run the command in the wrong context. A common mistake is trying to run this in he shell itself where you'll get an error like:
-bash: reload!: command not found
One other thing you may need to do if you're having trouble getting things to load that should be there is to stop the Spring launcher, forcing it to reload:
spring stop
That kicks the Spring application preloader which can sometimes get confused about what's going on and needs a reset.
hope I can get some help with a problem I have been having. I am getting into Ruby on Rails and used a tutorial (http://guides.rubyonrails.org/getting_started.html) to try to get started with it. It says I need Sqlite3. I followed the steps up to the point where it says to use the ruby bin\rails server command in command prompt. However, when I try to do this, I get the following error message.
When I try to install Sqlite3, I use the x86 version for Windows, as I am using Windows 8.1.
I don't know what I am doing wrong...I am not even sure if the SQlite3 files are in the right place. I use command prompt to check if I have Ruby, Rails, and Sqlite3 all installed, which I do. I also know I have the SQlite3 Ruby gem installed. I have also added SQlite3 to my PATH system variable, but that doesn't seem to work either. I always get the same above error message no matter what I do.
Anyone have any ideas as to what the problem might be? Any help would be greatly appreciated! Thanks!
I recommend setting up a Linux VM on your Windows PC and start coding on it instead of on Windows. You'll keep encountering many issues in the future if you stick with Windows. Windows & ruby on rails don't go well together. So, it's better to go with some Linux flavor or preferably Mac.
If you are going to be learning RoR with the goal of ever doing anything serious in the future, here's the best advice I can give to someone starting out: Buy a Mac. NEVER try to use Microsoft for anything but Microsoft office... you'll just end up so frustrated that you will give up. RoR is NOT the toy to try "round peg, square hole" with.
Next, being that your on a Mac, NEVER use sqlite3. You can easily use the correct database which is PostgreSQL. Why is this important?
You're starting out. Keep things very simple. Get a free Heroku account, and install the CLI (for mac). You can then do: "heroku local" to run your code locally (for building), and because it's Mac/PostgreSQL, when you go to push that code live, everything is the same (Heroku is going to be PostgreSQL) so you won't get lost for days trouble shooting the differences between where you're building the code, and where you're running the code.
i'm working on a Ruby on rails project adopted by another developer. It's deployed on heroku, uses heroku postgreSQL.
When i run the project on my local rails server with the remote database, it works fine. But there is one problem: I would like to delete some entries. So I tried to connect via PostgreSQL-Console. But it seems like the PostgrqSQL-Console gives me another version of the database than the one who is used by the app.
For example, the latest user ID in the app is 540 and in the database displayed by the console only 500.
Any idea? Thank you in advance.
Problem is solved. The elastic search index wasn't synchronized. Thank you for your help anyway.
This is my last resort to figure this out. I've searched through stackoverflow and googled various topics, but it seems to come down to how to interpret/analyze my own Heroku log. There's so much going on that I'm not sure where to look first. I see things like eager_load and direction to files app/config/environment:rb:5 and there also seems to be issues with my Unicorn configurations and relationship associations. I've gone through my files and haven't been able to locate what my logs are referring to, up until now it's been really easy to interpret errors.
A little background: I had originally built my rails app with the default Sqlite3 settings and I have attempted to switch it to Postgres. So maybe there's some conflicts with that going on as well. I want to be able to read my Heroku Logs in the future on my own and know exactly where to look. So if someone could provide a good tutorial about reading Heroku Logs that would be great as well.
Here's where I've looked so far:
I've looked on devcenter on heroku's website, but I'm not making the connection from their instructions, to the issue in my code. I'm just a that stuck point, but have been trying to figure it out for days! I'm worried that I'm just missing something basic, which is why I haven't been able to figure this out yet.
I've also looked at association_basics.html on ruby on rails guides because I've been having some syntax issues.
I've used foreman start to see if my Procfile is working and have gotten another huge list. I've also used heroku ps, which gives me web.1 crashed
Here's the Heroku Log that's also connected to my app's github page:
https://github.com/jsmit032/seasons-app/issues/29
If any other information is required, please let me know and I'll edit my questions so hopefully this can help others as well.
2014-11-21T19:27:58.271705+00:00 app[web.1]: has_many :user, through :user_to_destinations
doesn't look right - it should be
has_many :user, through: :user_to_destinations
at /app/app/models/destination.rb:3
So I got the whole app to deploy! Turns out it was a pre-complied issue.
So I went through the guide on Heroku for pre-compiling assets in Rails 4: https://devcenter.heroku.com/articles/rails-4-asset-pipeline
I also went through the heroku guide for prepping your rails 4 app:
https://devcenter.heroku.com/articles/getting-started-with-rails4#migrate-your-database
Also went through the heroku guide for SQLite on Heroku and the Deploying Rails Applications with Unicorn guide.
Looking through the console errors on the actual site was a huge help. It's how we figured out that the assets pipeline might not be working.
I am trying to solve a strange issue with ferret/acts_as_ferret
Of course I have googled and posted the question:
http://www.ruby-forum.com/topic/188570
Basically aaf works on single models with no issue. It also works on single models using the config/aaf.rb file I have setup. It even works when I do a multi-model search in the console, but within the rails app itself I get:
undefined method `ferret_rank=' for <object that has a match>
If anyone has had the same experience/problem and can shed any light I would appreciate it.
PS: I followed the following tutorial to get where I am now.
http://opensoul.org/2008/4/29/using-shared-indexes-with-acts_as_ferret
Do you have the plugin installed or just the gem? You might want to install the plugin.
I would also try rebuilding the index.
For my purposes, I switched to Solr and life is a lot easier. Sphinx is missing a lot of stuff that I need.