@Gabriel
HAHA! Finally! The fix did work, there was just a backup file from emacs that was still used instead of the corrected version (does any experienced emacs user know how I can supress the generation of these someFile~ backups with a tilde in the end?)
Could you please put up a screencast or how-to on using BlueprintCSS as mentioned in class? I'm a newbie designer and don't know the first thing about CSS and stuff...
Another quesiton, how do you get all your controllers to use the same application stylesheet? I use scaffold and it generates one layout per controller and I can't figure out how to make them all point to the same..i mean i know you do
stylesheet_link_tag 'application'
but then if I try to remove the stylesheet generated from scaffold for that controller, it defaults back to the normal settings, and doesn't use the application..all our assignments and example code do what I want, but I can't figure it out how to get it to work for my application..moreover, by default rails doesn't generate the scaffold.css in the public directory which is weird..all this is a little screwy ot me...
I think you can use the standard HTML comments to comment out the HTML code, but I think you can use =begin and =end to comment out multiple lines of ruby. http://ruby.about.com/od/rubyfeatures/a/comment.htm
As far as I can tell, in the top of your controller, you can just add a layout definition there:
class MyController < ApplicationController
layout 'my_layout'
Gosh darn it, I don't know why I figure things out right after I post a quesiton!
Anyways, it was a real odd ball fix. You have to manually remove all layout files in the vview/layout directory save applicaiton.html.erb for things to work right! go figure!
For multi-line comments I've been using this:
=begin
code & stuff
=end
just be careful, the "=begin" & "=end" must be at the beginning of the line.
As for the stylesheets, I haven't played with them yet, but I am planning to do the following (I'm also generating a lot of scaffolds) and hope it will work:
- Get rid of all the extra layouts, creating one single application layout
- have application layout reference the stylesheet I want to use across the board
Is anyone else working with the ym4r_gm plugin to incorporate maps functionality? I've got it wired up okay, but am having one fairly significant hang up. I've got a map embedded in a view used to create a new object & if the create fails on model validation, the map stops working. There isn't an error per se, but when I re-render the :new view, the map isn't there & instead is just a text representation of the map ('map.div()')
If anyone has experience with the plugin in question and can point me towards some good references beyond the basic load a map with markers etc, I'd appreciate it.
@Gabriel
Comment nr. 91 in this railscasts mentions the same problem:
http://railscasts.com/episodes/102-auto-complete-association
Unfortunately the fix didn't work for me...
@Gabriel
HAHA! Finally! The fix did work, there was just a backup file from emacs that was still used instead of the corrected version (does any experienced emacs user know how I can supress the generation of these someFile~ backups with a tilde in the end?)
@Gabriel
I should probably write up to the steps to use auto_complete -- the account in AWDR is terrible.
For all you javascript afficianados out there...
http://www.chromeexperiments.com/
Browser ball is my favorite. of course they all work best with CHROME.
another random note...
for any of you systems folks out there check out the Puppet Project
http://reductivelabs.com/trac/puppet/wiki/AboutPuppet
we have been using this to manage a larger (6000+) linux farm.
its written entirely in Ruby.
How do you get script/console to list your tables in the pretty manner like they do in the railscast screencasts?
@Lateral Punk
I think it's hirb - http://tagaholic.me/2009/03/13/hirb-irb-on-the-good-stuff.html and http://tagaholic.me/2009/06/19/page-irb-output-and-improve-ri-with-hirb.html
Let us know if it works with Ruby 1.9.1. I also don't know how well it does with tables with a lot of columns.
works like a charm!
Could you please put up a screencast or how-to on using BlueprintCSS as mentioned in class? I'm a newbie designer and don't know the first thing about CSS and stuff...
Are the videos to the lectures going to be avail after the course is over?
@Lateral Punk
Yes. It is conceivable that I would take them down for awhile because I'm reconfiguring the server, but . . . yes.
HOw do you do comments in ERB files e.g.
<!-- { :action => "update" } do |person_form| %>
Delete:
-->
and rails barks...
I want to be able to comment out code which I'm using as reference or wahtever..seems non trivial from what I've seen on the net...
Nope. doesn't work.
Need something that is multiple lines and actually comments it out, and in the erb files.
Another quesiton, how do you get all your controllers to use the same application stylesheet? I use scaffold and it generates one layout per controller and I can't figure out how to make them all point to the same..i mean i know you do
stylesheet_link_tag 'application'
but then if I try to remove the stylesheet generated from scaffold for that controller, it defaults back to the normal settings, and doesn't use the application..all our assignments and example code do what I want, but I can't figure it out how to get it to work for my application..moreover, by default rails doesn't generate the scaffold.css in the public directory which is weird..all this is a little screwy ot me...
repharse the above with layout..e.g. how do you share the layout/stylesheet amongst all the controllers to be the same like in our assignments...
@Lateral Punk
I think you can use the standard HTML comments to comment out the HTML code, but I think you can use =begin and =end to comment out multiple lines of ruby.
http://ruby.about.com/od/rubyfeatures/a/comment.htm
As far as I can tell, in the top of your controller, you can just add a layout definition there:
class MyController < ApplicationController
layout 'my_layout'
HTH
-peter
Gosh darn it, I don't know why I figure things out right after I post a quesiton!
Anyways, it was a real odd ball fix. You have to manually remove all layout files in the vview/layout directory save applicaiton.html.erb for things to work right! go figure!
@Lateral Punk
For multi-line comments I've been using this:
=begin
code & stuff
=end
just be careful, the "=begin" & "=end" must be at the beginning of the line.
As for the stylesheets, I haven't played with them yet, but I am planning to do the following (I'm also generating a lot of scaffolds) and hope it will work:
- Get rid of all the extra layouts, creating one single application layout
- have application layout reference the stylesheet I want to use across the board
@AdamK
@Lateral Punk
To use just the one layout, remove the others, and just have application.html.erb
Regarding multiple-line comments -- AdamK, will the =begin/=end strategy work in .erb templates? I thought not, but maybe I'm wrong.
@john
My bad - had read the question two fast. It doesn't work with .erb templates.
@AdamK
OK, that does work:
Remember that your views should be pretty dumb -- the heavy lifting should be in the controller. So presumably your view comments are short and sweet.
@AdamK
I may be hallucinating, but try it in the manner of what I pasted in here
@john
As could I, but it doesn't work for me. I tried putting it around a form_tag block and it returned errors - "SyntaxError in XXX"
Is anyone else working with the ym4r_gm plugin to incorporate maps functionality? I've got it wired up okay, but am having one fairly significant hang up. I've got a map embedded in a view used to create a new object & if the create fails on model validation, the map stops working. There isn't an error per se, but when I re-render the :new view, the map isn't there & instead is just a text representation of the map ('map.div()')
If anyone has experience with the plugin in question and can point me towards some good references beyond the basic load a map with markers etc, I'd appreciate it.
Adam
@AdamK
What does the "create" do? If the model is intimately associated with what is shown in the view, should the view be able to do anything anyway?
@AdamK
I figured out my map problem. I was mixing up when I should be creating a map versus referencing an existing map.