Rubys on Rails project Using Aptana - ruby-on-rails

I am having a major issue with creating a Rails Project on Aptana (using mac os x). Basically, when i try starting a Rails project and name a file, it comes back with an error saying:
"!!! Path to log file not valid: /Users/fab/Documents/Aptana Studio Workspace/test.rb/log/mongrel.log mongrel::start reported an error. Use mongrel_rails mongrel::start -h to get help."
and then a pop up comes up saying: "Rename the directory to no longer have a space"
After all this, i tried renaming the directory without spaces, but then when i went back to create a new project again it came back with this pop up that says "resource'/fab/public'does not exist." Under this there is a list of two options: "periodic workshop save" and "replace project index file."
What does this mean, and how can i fix the problem?
Any advise would be much appreciated!
Omarj

Mongrel used to have a bug with writing log files, and for whatever reason it's trying to create a path relative to a file (rather than a folder) in your case. i think they also had issues with spaces in the path.
Do NOT rename your workspace path, or Studio/RadRails won't see the files anymore (as you saw above) - because you moved them.
I suggest renaming the folder back. This question is pretty stale, so mongrel is no longer widely used. you could try one of the other server types, like webrick.

Hey, I don't have an answer to your question. However, would advise you that if you are starting to get your hands dirty with Ruby and Rails, then consider TextMate as your IDE instead of RadRails.

Related

Issue with Rails Generator Building a Plugin

I am building a Rails plugin for an application at work.
I want to extract logic that was used in multiple locations, but implemented slightly differently, and add new features needed without doing it 2-3 times over.
I've never build a gem, but according to what I was reading it is possible to use rails generate.
However this has not been the case for me.
Running rails g model Something stuff:type:
First interesting thing is that it is generating mini test stuff when I explicitly told the plugin not to use mini test (using Rspec).
Then looking in my folder structure for the plugin, no db/ folder, nothing added to app/models/, and no test/ folder:
Running the command a second time reveals to me that the files are indeed created:
My questions are:
Where is this stuff going? Can I even find out?
Has anyone encountered something similar? Is it due to a misconfiguration, or bug? Essentially, what's happening?
I would truly appreciate any advice or suggestions!
EDIT #1
Forgot to mention that I checked within the spec/dummy application in case things were being created there, and it is still empty as I left it.
EDIT #2
So I found where the files were by using the find command:
And yeah it added the files to my home folder...
At least now I can just paste them in the right location, but obviously this is bizarre and I'd like to get this resolved, figure out what is going on.
Okay so turns out that yes you may use Rails Generators when building a gem. Also, the generated files will not be placed inside the dummy application unless you are in that directory.
Everything is working as expected on a different computer.
That stuff is going into dummy app that is usually located in test/dummy. In your case, it seems to be located in specs/dummy.
Yeap and nope. That's not misconfiguration.

Psych Error: `parse': (<unknown>): could not find expected

`':' while scanning a simple key at line 16 column 1(Psych::SyntaxError)
I'm working on a Rails application tutorial and have had the above error come up several times. When I was getting this error it seemed to only be a problem if I used one particular terminal window. I have since restarted the computer and now it is a problem regardless of what I do.
I went to the project on github and copied the information in 'secrets.yml' into my file in case that was the issue but doesn't help. In fact I'm not sure if that is even the file causing the problem because when I shift the code in that file and save it I still get the same error; at those times it points to a line that is now blank in the 'secrets.yml'
Update.
now I am getting this when i run this command
rails generate simple_form:install --foundation
-bash: $: command not found.
only change I did was start the code in 'secrets.yml' lower down, and i added a secret key to my .bash_profile, as it was suggested in tutorial and I had not done it before, and thought that might be the problem.
Update 2
shut down terminal and tied again and getting the original problem "psyche Error" Yes, thank you for your feedback, I too, although not sure why, suspect it is to do with the 'secret' file or could it be changes the tutorial told me to make to my .bash_profile. The instructions were not very clear, wondering if that is where I messed up. If that is so then I would not know how to fix that.
The Psych gem is the wrapper around libyaml and used within Ruby's YAML class, so it's not surprising you think it could be the 'secrets.yml'; a YAML config file. I'd stay the course and find what isn't being formatted correctly.

Redmine 404 on some pages

I have installed Redmine on a shared Bluehost account and at first sight it seems to be working.
I followed both of these tutorials: https://my.bluehost.com/cgi/help/redmine and http://www.redmine.org/projects/redmine/wiki/RedmineInstall
But just as i started navigating around i noticed that there seem to be a routing problem because some of the pages are returning a 404 error code for a reason i don't understand yet.
The error log shows no information regarding this problem.
The url is on redmine.example.com , the user/pass are still admin/admin.
I have identified that any URL regarding a project is failing, for example:
http://redmine.example.com/projects/new
http://redmine.example.com/projects/21
http://redmine.example.com/projects/21/issues
(Currently i have reset the DB for privacy concerns)
In order to prove my theory that it was regarding the projects issue, i went into the projects controller file found in app/controllers/projects_controller.rb and tried to put some abort("Foo") here and there but i couldn't see my message with any of the links that are not working so i thought maybe the problem is not there and is probably in the routing process. So i checked the config/routes.rb file and comparing it with my local version they seem identical
I am not sure what to try next as i am not a Ruby developer. Let me know what kind of info you need in order to help debug this problem.
Eventually i got it working by using FastCGI.
In order to do that, i simply created a .htaccess file and a dispatcher.fcgi as shown in the answer here : Redmine 2 on Hostmonster apache fcgi: Rails application failed to start properly
Don't forget to SetEnv GEM_PATH to your ruby gems path in your .htaccess file and it should work after restarting (pkill dispatcher.fcgi)

rails console yaml parse error - applying solutions

BACKGROUND Complete newbie to coding working thro’ RailsTutorial on a windows 7 PC– I’ve stalled on chap 4.2 with an YAML error running “rails console” from a command prompt with Ruby on Rails.
I need tips on how to interpret and use some specific answers (below) that I found posted on stackoverflow/google groups/github.
I’ve tried to meet forum criteria for questions. If any of my confusions are too basic here please let me know which & where else I might try.
The error -
~\Sites\sample_app rails console
C:/a_installers/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:154:in 'parse
: (<unknown>): couldn't parse YAML at line 44 column 11 (Psych::SyntaxError)
from C:/a_installers/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:
54:in 'parse_stream'
(40 more lines like this)
Not sure what useful context I can supply.. possibly that I used Railsinstaller and later Pik (instead of RVM) on Windows 7, that I installed ralis/ruby programs under c:\a_installers\railsInstaller and that I’ve updated PATH to include ruby bin folders.
QUESTION The advice I'm having difficulty interpreting/using is..
rails error, couldn't parse YAML suggests
a. Run the YAML code through yamlint.com
Which YAML file? All those in the error listing? I think I’m running rails console from my installed rails program area (above), there I found 60 odd files with “ *.yml “ – do I have to run all these through YAMLlint.com?
b. Manually Fix the YAML code
One example given was " fixing invalid yaml " involving splitting yaml code for a local date into lines.This was not applicable – I couldn’t find any such code in any of the 60 odd “ *.yml “ files under railsinstaller on my system
c. “load the old YAML parser (syck) with code xxx in config/boot.rb”
Two problems…
(1) I couldn’t find boot.rb in my the rails/ruby program area
(2) I’m torn between two contrary views expressed
“Psych is the new one, the one you should be using you have some invalid yaml somewhere.”
And
“wrong… ruby should use a parser that is both maintained and supports existing usage, even if that usage is further from the spec. If only there were such a thing. Until there is, they should use syck..”
In summary, not sure which files to amend, how to do that, how to check that. if it’s advisable instead to do a workaround (reverting to syck) and if so in which directory and with which files.
another source rails-yaml-config-best-practice advised
“configure parameter inside environment.rb.” use a github code called “settings logic”
Not sure how to do this..do I need to learn YAML? Tutorial hasn’t even started Ruby yet – is this
Not sure where to do this – couldn’t find environment.rb in my rails/ruby program area – it seems to be part of my application (sample_app)
In ..Settings_logic …the notes seem to bring me full circle to 1. above.
“..Note: Certain Ruby/Bundler versions include a version of the Psych YAML parser which incorrectly handles merges (the << in the example above.) If your default settings seem to be overwriting your environment-specific settings, including the following lines in your config/boot.rb file may solve the problem:
require 'yaml'
YAML::ENGINE.yamler= 'syck'
To apply this solution I still need to resolve question 1 c (2)
3 General advice - My inability to start rails console seems an absolute barrier for me to use ROR- a couple of general questions - Do practitioners use rails console for actual development or just learning? Can I learn RoR without rails console?
Many thanks for your patience, time and attention.

Passenger "No such file to load" error for Model

I'm having a problem with deploying a Rails 3 app to a Passenger/Apache2/RVM server running Ubuntu 11.10.
I'm getting the error:
A source file that the application requires, is missing.
...
Error message: No such file to load -- Goal
Exception class: LoadError
Goal is one of my Rails Models.
I've seen a lot of people with a similar error message, but their issues seem to relate to missing bundles/gems - not model files! Their problems were resolved by ensuring permissions were set up correctly, so to that end I've got:
Apache running as www-data, as is Passenger. RVM is installed as www-data and I've chown'd the entire web app directory to www-data.
I've been wrestling with this for some time now and am really out of ideas - if anyone has any suggestions I'd be very grateful!
You might probably have the file structure of your Rails app wrong. Are you sure you have the "goal.rb" file within {your_app_root_url}/app/models/ ?
To me, if I am seeing the error when you view the app in browser, it seems like your rails app and passenger(with apache2) are working fine. The other possibility is you might be looking at wrong app folder which passenger is set up to.
It's hard to tell what's wrong. Please provide more details of how you set up your passenger with your rails app directory. Also it would help if you could show what's inside your app (app structure) and what's inside goal.rb model file.
Well I've solved it. Turned out that a work around for a problem with yaml encoded model archives (i.e. an explicit require of Goal) in a completely unrelated Model was causing the error to appear. Looks like it only rears its head in production - probably due to the differences between the class loaders used in development vs. production.
Tough one to find... the stack trace didn't include a reference to where the problem actually was!

Resources