[Rails] Re: cannot open database under Passenger

2009-06-10 Thread Mk 27

Rick Denatale wrote:

> By default though the passenger process for a rails app tries to run
> as the user which owns conf/environment.rb unless configured otherwise
> it runs as the user nobody unless configured otherwise.
> 
> http://www.modrails.com/documentation/Users%20guide.html#user_switching
> http://www.modrails.com/documentation/Users%20guide.html#PassengerUserSwitching

Thanks Rick.  I added this to httpd.conf

PassengerDefaultUser root

and presto.


_MK
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: cannot open database under Passenger

2009-06-10 Thread Mk 27

Frederick Cheung wrote:
> On Jun 10, 11:06�pm, Mk 27  wrote:
>> After switching to passenger from WEBbrick I keep getting "attempt to
>> write to read-only database", so I chown'd the sqlite file apache.apache
>> and chmod'd 666, now I get "unable to open database file"?
>>
> What user is passenger set to run your ruby code as ?
> 
> Fred

Here's the stuff I put in httpd.conf:

LoadModule passenger_module 
/usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
  PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.2
  PassengerRuby /usr/local/bin/ruby

NameVirtualHost *:80


ServerName dev.docsearch.net
DocumentRoot "/var/www/html/docsearch/public/"
RailsEnv development
Alias /filesystem /


Apache runs as "apache".

_MK
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] cannot open database under Passenger

2009-06-10 Thread Mk 27

After switching to passenger from WEBbrick I keep getting "attempt to
write to read-only database", so I chown'd the sqlite file apache.apache
and chmod'd 666, now I get "unable to open database file"?

-MK
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger on localhost

2009-06-06 Thread Mk 27

Rahmat Budiharso wrote:
> I use passenger to, and it works like a charm.
> this is what i got in my /etc/apache2/sites-available/rails
> 
> 
>ServerName rpdam.local
>DocumentRoot /home/rahmat/Rails-Projects/pdam/public
>RailsEnv development
> 

I had it like this:


ServerName dev.docsearch.net
DocumentRoot "/var/www/html/docsearch/public/"



   RailsEnv development


Which I copied that from the Phusion webpage documentation.  Anyway, 
moving "RailsEnv ..." into the VirtualHost block worked.  I guess that 
documentation kicked my ass!

Thanks Rahmat.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger on localhost

2009-06-06 Thread Mk 27

Steve Ross wrote:
> Are you watching your logs?  You should have all kinds of information
about what went wrong. Are you running in development or production
mode?

As I mentioned earlier, there is *NO* output to any logs by passenger, 
other than

Apache/2.2.10 (Unix) DAV/2 Phusion_Passenger/2.2.2 configured -- 
resuming normal operations

Apache's log level is set to "debug".  There are 0 bytes in the actual 
app logs. And there is at least an entire post here about my mode.  I 
have the feeling we are using different software.

> Really, the Phusion documentation is kick-ass great.

I would feel that way too, if "Phusion Passenger" itself worked.  Since 
my app runs fine under WEBbrick, I am kind of at a loss.

Certainly, it is not "kick-ass" to have the software throw up this 
notice

"We're sorry, but something went wrong. We've been notified about this 
issue."

and then do absolutely noting else (who is this "we" and how were they 
"notified"?  Maybe it is inclusive, like:  "Here we are.  Something went 
wrong! We -- including you -- have just been notified.  Goodbye!"  I 
feel kind of like Dave talking to Hal, outside the air lock*.).  I would 
say it was lame, but I don't want to offend anyone ;)


*like wow, what kick-ass software.  It lies!





-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger on localhost

2009-06-05 Thread Mk 27

Mk 27 wrote:
> I find the addendum
> 
> "We've been notified about this issue..."
> 
> somewhat ironic as it is not true.  So fallacious, more than just 
> "ironic".


Does anyone actually use passenger?  Is there anyway to get it to 
provide some trace output via apache, a la WEBrick?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger on localhost

2009-06-05 Thread Mk 27

I added


RailsEnv "development"



But not luck...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger on localhost

2009-06-05 Thread Mk 27

I find the addendum

"We've been notified about this issue..."

somewhat ironic as it is not true.  So fallacious, more than just 
"ironic".
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger on localhost

2009-06-05 Thread Mk 27

Okay, I added an alias for "dev.docsearch.net" and httpd.conf now 
contains:


ServerName dev.docsearch.net
DocumentRoot "/var/www/html/docsearch/public/"


which does take me to the index.html, but if I try a method I get a 
rails message:

"We're sorry, but something went wrong."

Unfortunately, there is *absolutely no information* about the 
"something" error to find, either in docsearch/logs or in the apache 
logs.  Up to now I've just been working in a "development" environment. 
Does that have anything to do with it?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger on localhost

2009-06-05 Thread Mk 27

Steve Ross wrote:

> Edit your hosts file and point 127.0.0.1 to some local name like
> docsearch.local.

127.0.0.1 already points to localhost and some other aliases.

> Or, if you're on a Mac, just install PassengerPane
> and drag/drop the folder to there and forget about all the junk I just
> said :)

I'm on linux, and I prefer to avoid GUI apps in programming as much as 
possible (which IMO should always be possible).

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] passenger on localhost

2009-06-05 Thread Mk 27

I installed passenger at home.  How should I configure apache to make it
usable?
This was my last guess:


ServerName 127.0.0.1
DocumentRoot /var/www/html/docsearch/public


This gets by "apachectl start" without complaint, but I really haven't a
clue what I'm doing ;)

Do I need to access it via a different port?  Or could I just set up a
link in my /var/www/html/index.html page?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ActionController::InvalidAuthenticityToken & :before

2009-06-05 Thread Mk 27

Sandip Ransing wrote:
> In your controller add
> skip_before_filter :verify_authenticity_token
> 
> Hope this will help !

Thanks for that tidbit, but the problem was that the wait_message() 
function destroyed the content of the div with the form in it and 
replaced it with the message, S E A R C H I N G

Of course, the form is not yet submitted and it contained the auth token 
in a hidden field!  So the more is:  don't destroy the form in your 
:before callback.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Suggestions for notifying user on changes?

2009-06-04 Thread Mk 27

The first paragraph is a great idea!

The second is terrible!  Using a cron job is almost as silly as emailing 
(but not quite, at least you will be keeping your silliness to 
yourself).

Why don't you just collect all this information when they next log in? 
If you have timestamps for all events, including logging in and out, you 
just compile a little "digest" of events that have occurred since the 
last log in, and then the user is free to examine that at their leisure.


-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ActionController::InvalidAuthenticityToken & :before

2009-06-04 Thread Mk 27

I suppose it was not a good idea to replace the form with "removeChild" 
:before the form is submitted...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ActionController::InvalidAuthenticityToken & :before

2009-06-04 Thread Mk 27

Here are more details from that error:

Processing DocdirController#search (for 127.0.0.1 at 2009-06-04 
11:34:39) [POST]

ActionController::InvalidAuthenticityToken 
(ActionController::InvalidAuthenticityToken):
  :8:in `synchronize'
  /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
  /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
  /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in 
start_thread'
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Calling JavaScript

2009-06-04 Thread Mk 27

Tyler Knappe wrote:

> <%= javascript_include_tag :defaults %>
> <%= javascript_include_tag 'test' %>

If testjs() is in application.js or public/javascript/test.js it should 
respond if it is formatted correctly.

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Calling JavaScript

2009-06-04 Thread Mk 27

Tyler Knappe wrote:

> So I would think that the function 'testjs' defined in test.js would be 
> defined.  I tried moving the function into application.js with the same 
> result.

and you have

<%= javascript_include_tag :defaults %>

in the header?


ps.  IMO rails will be a very awkward place to learn javascript, if that 
is what you are doing.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] ActionController::InvalidAuthenticityToken & :before

2009-06-04 Thread Mk 27

I have a form that submits search criteria and while it is processing I
wanted to use a js function to indicate:

<% form_remote_tag :update => 'mainbody', :url => {:action => 'search'},
 :before => "wait_message('mainbody','S E A R C H I N G')" do%>


wait_message() executes but then when the data comes back, I get

ActionController::InvalidAuthenticityToken in DocdirController#search

Everything works fine without the :before => callback.  How should I do
this?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Controller method that doesn't require a view

2009-06-04 Thread Mk 27

JannaB wrote:
> I have a submit button on a form, which is in a div. When submitted,
> an email is sent, the div closes, all else remains the same in the
> view. Im just having a hard time in my mind fitting this into the
> Rails MVC paradigm here. How can I do this? -Janna
> 

I don't think that is so much because of rails but because that is a 
consequence of submitting a form.  However, you could investigate what 
Fred suggests or try

<% form_remote_tag :update => 'dud', :url => {:action => 'the action'} 
do%>

I just tried this and nothing complains if you try to update a 
non-existent page element ('dud'), so that will work.  The page with the 
form remains with nothing changed, but the controller does process the 
form.

:)
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Local file href or redirect

2009-06-03 Thread Mk 27

pharrington wrote:
> I'm *pretty sure* this is just a function of your browser's security
> model not allowing access to filesystem URIs from an http:// page.
> Either way though, its not anything Rails has to do with.

Yep!  I would never have guessed that.  There is no way to disable this 
AFAICT either.

But I started apache (default port 80) and then used

http://localhost/filesystem/somepath/etc

and that works.

Much thanks
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Local file href or redirect

2009-06-03 Thread Mk 27

If I include a link like this in a view:

http://www.ruby-forum.com";>GO!

The link works normally.  But this:

GO!

is somehow blocked, and there is NO ERROR OR OTHER FORM OF EXPLANATION
OR NOTIFICATION by webrick, rails, et. al.  That is very un-user,
un-programmer, un-friendly and I should sue ;]

How can I access a local file url???
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: encoding issue

2009-06-03 Thread Mk 27

Well, I solved it using Encoding::Convert.  The difference between 
"each" (which does not allow in place changes) and "each_with_index" had 
me hung up.  Ruby newbie!

I would still LOVE to know why/how iconv self-destructed tho...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: encoding issue

2009-06-03 Thread Mk 27

This works in a non-rails script:

  def enconvert(text)
conv=Encoding::Converter.new("ISO-8859-1","UTF-8",
:undef => :replace, :invalid => :replace)
text.each { |ln| ln=conv.convert(ln) }
  end

but in rails I still get an error, after "converting" the same page.

SURELY SOMEONE has dealt with encoding conversion before??


ps. iconv mysteriously self-destructed on my system this morning.  It 
worked briefly, but now

require "iconv"

produces an error (so iconv is now unusable on my system until I rebuild 
ruby).  Does anyone know if Encoding::Converter uses iconv under the 
hood?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] encoding issue

2009-06-03 Thread Mk 27

I'm having a problem with output gleaned from searching ISO-8859-9 web
pages.

I thought I had rectified this by opening the pages "r:ISO...", and by
using .force_encoding and .encode! with the lines.  This seems to work,
as according to logger.info output, execution makes it all the way
through the controller AND the view code...meaning I would have thought
there is nothing left for me to do.

After the controller code has run I get:
Rendering docsearch/search
Then the view code runs and I get:
Completed in 1179ms (View: 11, DB: 1) | 200 OK
[http://localhost/docdir/search]

THEN,
Processing ApplicationController#search
which seems strange, since
Processing DocdirController#search
already happened.  I had not noticed this before; what is the difference
between these two, and what is the significance of "Processing
ApplicationController#search" AFTER the view is already complete?

Anyway, that's when I get
ArgumentError (invalid byte sequence in UTF-8):
  :8:in `synchronize'
  /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
  /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
  /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in
start_thread'

So I have tried setting both internal and external encodings:
Encoding.default_external = @dir.encoding
Encoding.default_internal = @dir.encoding
In the hopes that this would mean everything -- parsing, IO, etc. will
be done in ISO-8859-1, but obviously this is not the case.  I presume I
cannot set the encoding for the scripts that aren't mine, ie, the
webrick scripts that are throwing this error.

What can I do?  AFAICT, all my code has executed without error, every
line dealt with is output via the logger, in the controller AND in the
view, A-ok, and then this happens?  Why can I not just set *everything*
to one encoding for a duration?  Is it webrick?  I also tried using
Encoding::Converter on everything read in, to no avail...Help!

--MK
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Something to pretty up my terminal

2009-06-02 Thread Mk 27

Philip Hallstrom wrote:

> If you're using capistrano, install the capistrano_colors gem and then
> add this to the top of your deploy.rb file:
> 
> require 'capistrano_colors'

Like that idea.  Add that and you will have to start shielding your 
eyes.  The text terminal is your friend.  Do *everything* you can in the 
text terminal.  You will learn better and faster, I promise.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Something to pretty up my terminal

2009-06-02 Thread Mk 27

sir ziggles wrote:
> Was wondering if there is anything out there that i can use to pretty up
> my terminal's output? (linux)
> 
> Stuff like migrations and most rake tasks output as just white text on
> black.
> 
> thanks!


Myself, I like the classic linux dweeb look: a 100% transparent or 
slightly smoky terminal with no window decor added

http://www.intergate.com/~halfcountplus/misc/june2ss.jpg

Actually that one does have window decor, it's an XFCE Terminal I use 
with fvwm2.

I think the only terminal that uses tinted transparencies (eg, a nice, 
transparent red "ruby" look) is the "aterm", but AFAIK all the common 
distro/DE's (gnome, KDE, etc) use a terminal with a transparency option. 
You just have to choose your desktop background carefully.  I think most 
of them (inc. the XFCE Terminal) will also allow you to use an image 
inside the window as the background, potentially a tiled image so you 
could make it look like a web page.

Eterm uses shadows with the fonts, which is nice for contrasting with 
backgrounds, but Eterm is kind of gimpy IMO.

Play with your toys more.  You can change the text color too silly.  And 
remember: IDE's will rot your brain.


--MK
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: What's a smart way....

2009-06-02 Thread Mk 27

JannaB wrote:
> Thank you! Yes, it is the same menu, I am simply trying to replace it.
> I dont care what else is on the screen, I just want to flip the menu.
> I am getting hung up on the syntax here though, I have:
> 
> link_to_remote( 'Admin', :update => 'links_for_navigation' ,nil  )

I can't help you with the last part as I am quite new to RonR myself, 
altho I do have a programming background and can promise that I have 
already used link_to_remote to do this kind of menu substitution.


Here's an example.

The syntax of link_to_remote would be:

link_to_remote "Admin", :update => 'links_for_navigation,
  :url => { :action => :adminmenu }

Then, in your contoller, you have a method "adminmenu"

def adminmenu
# provide variables needed for the menu
@variables
end

and of course you need a matching view which actually constructs the 
menu, ie. the "innerHTML" of the menu div:

adminmenu.html.erb
--
<% @variables.each do |option| %>
<%=link_to_remote option.name, :update => option.target,
   :url => option.url%>
<%end%>

That is just a sketch; you can simplify using partials this way:

in the page source:
link_to_remote "Admin", :update => 'links_for_navigation,
  :url => { :action => :render_partial, :partial = "adminmenu" }
a generic method in the controller:
def render_partial
 render :partial => params[:partial]
end

Then you just have a bunch of _partials.html.erb for the different 
menus.  But this last technique, AFAIK, is not standard and someone has 
implied there may be a security risk in it, so beware, I'm a ruby newbie 
too!

Good luck -- MK


-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: What's a smart way....

2009-06-02 Thread Mk 27

JannaB wrote:
> But I want to only change the menu bar on that. This doesnt do that.

Okay, the specifics of your app are not clear to me.  If you place your 
menu bar in a div (sorry, I guess that div was not "Body"), then you can 
swap the contents of the menu bar the same way.

For example, if you have one horizontal menu bar with three items that 
all have a drop down or sub-menu attached, you can actually use just 
*one* drop down (or a box containing the active sub-menu).  To change 
the contents of the active sub-menu (or drop-down), you use 
link_to_remote with all the menu bar options, :update'ing the div 
containing the sub-menu.

Those links don't have to be in a separate menu (this I think is closer 
to what you are doing); they could be in the same menu.  So when you 
click on the "administrator" option, the :update refers to the *same* 
div that contains the menu with the administrator option.  Then the 
entire menu is replaced, and you have a "back to main menu" option which 
works the same way.  Get it?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: What's a smart way....

2009-06-02 Thread Mk 27

Make "administrator" a link_to_remote and use :update:

link_to_remote "Administrator", :update => 'Body' :url => { :action => 
...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Solid, serious tutorials?

2009-06-02 Thread Mk 27

agilehack wrote:
> Can anyone point me to one?  I have
> done most of the basic tutorials already and took a Rails intro
> course.
> 
> JR

I've spent the last few weeks learning ruby & RonR and I don't think 
there is anything beyond these basic tutorials.

I thought this was the most useful one:
http://www.tutorialspoint.com/ruby-on-rails/

but it is as simple as you could get.

Good luck -- maybe someone will fill us in better, vis. on-line 
resources.

I have a few books out from the library.  If you are willing to go that 
route, I'd recomment "Advanced Rails Recipes" (Clark et. al.) which is a 
collection of small projects (74 of them, in catagories) by all kinds of 
different people demonstrating various tools and techniques.  If you've 
already done the basic tutorials, etc, it shouldn't be hard to read.

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: process request and redirect to another url with all params

2009-06-01 Thread Mk 27

The key issue here is that this will need to be send as a POST request, 
whereas I assume the default of redirect_to is GET.

You will have to put the params onto to the end of the url string 
yourself, eg.

param1=this¶m2=16¶m3=that
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rails Erb w/ setAttribute "onclick"

2009-05-31 Thread Mk 27

Marnen Laibow-Koser wrote:

> Does that help?

Yeah, I see what you're doing.  Thanks Marnen.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: way to divide long article and store in database

2009-05-31 Thread Mk 27

Make each page a text file, put them all in a directory (document/1.txt, 
document/2.txt, etc), and then you won't even have to use the database.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rails Erb w/ setAttribute "onclick"

2009-05-31 Thread Mk 27

Thanks Fred.  Two more questions:

Frederick Cheung wrote:

> Normal js files are just served as-is (and if you have set things up
> right never even touch rails at all (ie they are server directly by
> nginx or apache)).
> 
> if you have an action that renders a .js.erb template you'll get what
> you want.

Yes, I ran across some references to ".js.erb" files; unfortunately I 
have not found much of an explanation of them. I have a couple of books 
from the library ("The Art of Rails", IMO at best mediocre, and "Ajax on 
Rails" which seems great).

I even grepped through the API for "\.js\.erb" and it's not in there 
even once...perhaps the suffix recently changed?  Anyway, any pointers 
to reading material here would be much appreciated.

> I have a sneaking suspicion that would allow an attacker to read any
> file on your hard disk (by passing the absolute path to the file as
> params[:part])

I just tried that; it might work if the filename has a _ for a prefix, 
but I doubt that since the server error also refers to the "views path 
app/views".

I am just working at home while learning anyway.  I was surprised when I 
noticed I get unrestricted access to the filesystem by default; I 
presume WEBrick was not intended for security.  I would assume that 
if/when I put something up on a real server, they will not be permitting 
that possibility if it can be prevented?  Otherwise I'm surprised anyone 
hosts Rails at all...but further thoughts from anyone would be welcome.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rails Erb w/ setAttribute "onclick"

2009-05-31 Thread Mk 27

After googling for a bit I now believe that you simply *cannot* put erb 
tags in a .js file.

I managed to get around this by rewriting the DOM as html and putting it 
in a partial, such that the (different) onclick that was supposed to 
call a js function with erb in it now calls an erb function with a js 
function in it...

 { :action=>:rendpart, :part=>"addmenu" },
:success => "new Effect.BlindDown('dropmenu')")%>">

but if anyone knows how to do what I have in the OP, please lemme know 
for future reference.

Also, is there a way to call "render" from within remote_function(:url 
=> {}) so I can skip the controller function that calls render?

   def rendpart
  render :partial => params[:part]
   end
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] rails Erb w/ setAttribute "onclick"

2009-05-31 Thread Mk 27

I'm trying to do this in a .js header:

tmp.setAttribute("onclick",'<%= remote_function(:update => "mainbody",
:url => { :contoller => :subject, :action => :new }) %>')

I've fiddled with the syntax slightly (eg, ' vs " vs \") but the best I
seem to get is an "Illegal XML character" error from firebug, citing the
erb tag above, which tag worked fine in the page source itself.

How can *use DOM* to set an "onclick" method to rails/Erb function?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: shortcut to call js function

2009-05-31 Thread Mk 27

Marnen Laibow-Koser wrote:

> Above all, please realize that nothing I have said was meant as a 
> personal attack.  You seem to be reacting as if I insulted your little 
> sister (I don't know if that's the impression you meant to convey), when 
> in fact I'm just trying to give you some useful guidelines for 
> programming practice.  I hope you will take my comments in the spirit in 
> which they have been intended, as I also have attempted to do.


Grumble.  Alright, I surrender.  You win, Marnen ;)  ...I think I've 
made my point and I'll leave it at that.


MK

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: shortcut to call js function

2009-05-30 Thread Mk 27

Marnen Laibow-Koser wrote:
> Mk 27 wrote:
>>  And 
>> please, do not hand me some basic case involving onload(), and claim "oh 
>> no, it could never be more coding, look...".  Certainly, it could never, 
>> ever, logically be *less* coding.
> 
> You are absolutely wrong.  Since inline JS, by its very nature, is much 
> harder to refactor, in many, many types of cases, inline JS will lead to 
> significantly more code than unobtrusive external JS.

I think we are talking about slightly different things.  I am not 
talking about defining functions inline.  I'm talking about calling 
them:

 You said you were snobbish about JS as compared to "real languages". 
> Well, guess what -- JS is a "real" language, and quite a powerful one 
> too, 

This was a joke about snobbishness, and not really anything else.  Sorry 
I did not make that clear earlier...

> "real" language.  That means writing complete routines in one place, not 
> scattered bits of inline code. [...]

The routines are in one place, a .js file.  The calls are, often enough, 
made in an html file.

> while keeping JS out of the HTML.  I guarantee that both 
> your JS and your HTML will be the better for it.

Inlining CSS is truly pointless, but when I look at a page source and 
see a mix of html, javascript, and embedded "whatever", I honestly do 
not, never have, never will, have some sort of absurd formatting related 
freak-out (like: "See how much tidier your html is now!!"  Grow up). 
You sound like someone who insists there is only one place to place an 
opening {, when in fact there are a number of acceptable styles and that 
is all they are: styles.

>> You are not 
>> talking about any improvement in functionality or performance, after 
>> all.
> 
> Wrong again.

No, you are wrong again.  If you want to tell me

<script type="text/javascript>call_my_function(here, forthis)

represents some kind of performance issue (considering call_my_function 
is already cached), I will tell you are wrong again, because you are.

>> I would hate to consider a case where an author decided *not* to do 
>> something because it required inline js.  
> 
> Read my lips: *NOTHING* REQUIRES INLINE JS!  Anything doable with inline 
> JS can also be done without it.

Possibly, although you don't make much of a case to support that.  But 
just because something *can* be done one way or another doesn't mean it 
*has* to be, unless you have a good reason for it, and since you still 
have not come up with one, I am satisfied that it doesn't exist.

MK

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: default form name in form_for

2009-05-30 Thread Mk 27

JannaB wrote:
> SO...how do you get teh form name for certain Dom / javascript
> functionality?

Give the form a name yourself:

form_for [...], :html => { name="adsf", id="hjkl" }

See the Rails API.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: shortcut to call js function

2009-05-30 Thread Mk 27

>From what I've read this issue should really hinge on the scale of a 
project; if you have a whole team of developers whose membership is 
subject to change, things like compartmentalization and generic 
maintainability have to be top priorities.

However, "getting the inline js" out will inevitably increase the actual 
codebase of the project as whole, because you will have to add *more* 
lines to your external scripts than you would have used in the page 
source by inlining in *at least some* (if not quite a few) cases.  And 
please, do not hand me some basic case involving onload(), and claim "oh 
no, it could never be more coding, look...".  Certainly, it could never, 
ever, logically be *less* coding.

Going back to the example to which I have been referring, you would have 
to throw that whole function out and use a combination of the simple css 
classing mentioned by marlen with "cut paste and modify"ing the html 
that would have been the majority of the output of the function.  This 
added effort will no doubt be justified and enabled by a large scale, 
team oriented project.

However, if you are the sole author and maintainer, the extent to which 
you do this (spend extra time coding to compartmentalize all the 
javascript) should really be tempered by the feasibility of doing so. 
I'm down with Occam's Razor here in that introducing a complication is a 
bad idea if the justification is purely about "universal" policies of 
style that have little significance for the case at hand.  You are not 
talking about any improvement in functionality or performance, after 
all.

I would hate to consider a case where an author decided *not* to do 
something because it required inline js.  That would be ass backward 
blind conformism.

-MK


-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: can't use :update => in form_tag?

2009-05-30 Thread Mk 27

Mk 27 wrote:

> The more I think about it the more sure I am this is the case, but I
> thot I'd check here for confirmation...

Then I find this "form_remote_tag" thing.  Yay.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] can't use :update => in form_tag?

2009-05-30 Thread Mk 27

Is this because a form submission REQUIRES the server to follow with a
new page?  Ie. it is impossible to submit a form, and have the view
returned used in a div (as with "link_to :update"); that view MUST
become a fresh page.

The more I think about it the more sure I am this is the case, but I
thot I'd check here for confirmation...

Thanks in advance, MK
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: shortcut to call js function

2009-05-29 Thread Mk 27

Marnen Laibow-Koser wrote:

>> The  I would say is part of an html page.
> 
> Yes.  That's not what I meant.  Rather, I meant that the 

[Rails] Re: Would ROR be a good choice to build my site?

2009-05-29 Thread Mk 27


> --Matt Jones

is a tad cranky!



You can't write a filter like all that, the place would need a 
moderator.

Not sure why you put this here, the OP had a totally valid question...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: shortcut to call js function

2009-05-29 Thread Mk 27

Marnen Laibow-Koser wrote:

>> It still seems to me that it is.  Where there is html, there can be 
>> javascript.  
> 
> Yes.  There can also be CSS.  There *should* be neither.

WHY!???!?  You want to make web programming *more* limited that it 
already is??
I agree "when convienient" but

> Rather what I'm talking about is simply having  
> in your HTML, then do something like
> 
> window.onload = function () {

1) what if this menu is part of a view being loaded into an existing 
div, and not part of a fresh page

2) create_menu_div would imply (or at least, I would hope) to me 
something a little bit more significant than just assigning some style. 
I do use a function like this, and it takes an array of choices (for the 
menu options) and a callback containing a switch(); the number of the 
choice corresponds to this, so rather than having to write a slew of 
onclick statements, etc,

choices = ["do this", "do that", "do both"];
create_menu_div(style, choices, parnt, callback);

>> Also, using an event handler still 
>> entails putting some javascript in an html page somewhere.
> 
> Not necessarily.  You can use the onload technique (as above) to assign 
> behavior without a single JS call in the HTML.  All you need is the 
> external 

[Rails] Re: shortcut to call js function

2009-05-29 Thread Mk 27

Rob Biedenharn wrote:

>> I will investigate writing a helper, thanks.
> It already exists:
> 
> <%= javascript_tag("some_func()") if x == 42 -%>

Thanks Rob!  I was sure I had run across this somewhere, but I have been 
rummaging thru so much new material while learning I was totally 
clueless as to where.  Perhaps I should take more notes...

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: shortcut to call js function

2009-05-29 Thread Mk 27

Marnen Laibow-Koser wrote:

> In sum, then...please don't tell me what I say is "patently ridiculous" 

It still seems to me that it is.  Where there is html, there can be 
javascript.  I would far rather use one line


[Rails] Re: shortcut to call js function

2009-05-29 Thread Mk 27

Sorry, yeah, that should be ==

some_func() is in an external file, but it does need to be called from 
in the view.  Your assertion that "javascript does not belong there" is 
patently ridiculous since many of the normal rails functions deploy 
JS/AJAX, in the view.  A central conceit of rails is XMLHttpRequest, and 
it is deployed IN THE VIEW.

I will investigate writing a helper, thanks.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] shortcut to call js function

2009-05-29 Thread Mk 27

Is there a shortcut for this kind of thing:

<%if X=42%>
 

[Rails] Re: using js prompt() instead of a form with create method

2009-05-28 Thread Mk 27

I am thinking it is actually impossible to pass a client side javascript 
variable into the server side rails without hiding a form somewhere...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] using js prompt() instead of a form with create method

2009-05-28 Thread Mk 27

I have a new/create method that only has one field, and I'd rather use a
js prompt() to get the data instead of a form.

The trigger for this is not a link, it's a span.  Using "onclick" in the
span, how can I call a prompt(), return the single param to the
contoller "create" method, and then call the controller "list" method to
update the page?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] how to set default path

2009-05-28 Thread Mk 27

Hi gang!

I want / to point to app/subject/list instead of public/index.html.  I
added this to routes.rb

map.connect ':controller/:action/:id', :controller => 'subject', :action
=> 'list'

But that does not work...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: migration issue

2009-05-27 Thread Mk 27

Hassan Schroeder wrote:

> nothing of interest to me either

Thanks for your non-advice!

;)

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: migration issue

2009-05-27 Thread Mk 27

Hassan Schroeder wrote:
> On Wed, May 27, 2009 at 7:34 AM, Mk 27 
>  wrote:
> 
>> because most sane people would want to preserve the contents of an
>> existing db when they modify it.
> 
> Erm, so maybe the most appropriate ("sane") thing to do at that
> point would be to figure out *why* you're (apparently) repeating a
> migration that's already been done?

There was an existing database, yes, I thought that was clear.  The 
reason I did it again was (also clear if you can read, but to repeat) 
because I wanted to move the session store to Active Record so I was 
following this instruction:

> You need to create the session table as below
> rake db:sessions:create
> rake db:migrate

Which I am grateful for that advice, because it worked; but I did have 
to create the db manually (because I want it populated, and already have 
a script to do that), add the session table myself (to the 
aforementioned script), and insert it back in.  So I guess I don't get 
the point of the migration thing yet:  is it more for people who don't 
want to create a db themself, or what?

Nb, this is my second casual week using rails.  If all I want to do is 
add a table to the database, why would it want to rebuild the whole 
thing, ie, why not just add the new table and leave the existing tables 
alone?  I presume there is away to do this and I haven't read enough of 
the API docs yet.  Is this going against "the convention", hence I 
needed to do some more "configuration"?

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] migration issue

2009-05-27 Thread Mk 27

I was following this set of instructions from the "Cookie overflow?"
thread:

> Your sessions (by default in cookie) needs to be moved to Active record
> store or memcache store to fix this issue.
> 
> For Databased sessions:
> config.action_controller.session_store = :active_record_store
> You need to create the session table as below
> rake db:sessions:create
> rake db:migrate

I added the config line to environment.rb; is that the approriate place?

When I ran the migration, I got

rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "artists" already exists: [etc]

So I removed the existing, populated database (to a safe place, since I
do not want to have to create it again unless necessary) and ran the
rake db:migrate again...clearly there is something I don't understand
because most sane people would want to preserve the contents of an
existing db when they modify it.

Now I have a problem, because of course the new (empty) database has an
extra table in it.  Before I go and write a ruby script to create a
database containing my old records + the new table as it appears in
schema.rb, is there not a simpler, more sensible way to do this?

If I do have to remake the db manually, can anyone answer a questions
for me regarding the session table: Does it also use a column "id" as
the INTEGER PRIMARY KEY?  I suppose it won't matter if it doesn't and I
put one in anyway...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: replace string

2009-05-27 Thread Mk 27

string = "i have a string need to replace every 10th
blank space of the string with some special character.is it possible,
the string does not have any \"\\n\", one single line."

i=0
string.each_byte { |c|
  i+=1
  string[i] = '*' if i%10 == 0
}

puts string




-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Cookie overflow?

2009-05-27 Thread Mk 27

Frederick Cheung wrote:
> On May 27, 1:46�pm, Mk 27  wrote:
>>
> Why a per user database? this could be stored in the database
> completely normally.
> 
> Fred

Then I will run into the same "simultaneous" user problem.  And it is 
not data that needs to be kept.  Let me flesh this out a bit, as I am 
sure other people have dealt with almost identical issues:

The database contains a list of music albums.  The user can view a list 
of all of them, or they could see a list based on some search criteria 
(artist or category).  I would like to elaborate on this to allow the 
existing list on view to become more highly customized, using drag and 
drop, deleting and adding chunks, etc.

By default, the list appears sorted alphabetically by title.  But the 
user should also be able to re-sort the existing list based on another 
criteria -- eg, album length in mb, release date, etc.  So rather that 
just deliver the list as it is requested using an @instance variable, 
I'm keeping it in the session hash.  This way, if they click "Sort by 
release date", I know what they are looking at and want sorted.

AFAIK it looks like I have two options:

1)Move the session data from cookie to Active Record
2)Use the session data to store the previous search terms rather than 
the whole list, meaning reproduce the list and sort it (which I guess is 
what I would have done if I had known there was such a tiny limit on the 
session store size -- at 20-60 bytes per item, it does not take much of 
list to reach 4k.  I was working on a "use memory not processor" bias. 
I guess that is backward?)

Opinions?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Cookie overflow?

2009-05-27 Thread Mk 27

Vishwanath Nayak wrote:

> For Databased sessions:
> config.action_controller.session_store = :active_record_store
> You need to create the session table as below
> rake db:sessions:create
> rake db:migrate

Ah, I guess that would be the temporary db solution...maybe I'll try 
this first.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Cookie overflow?

2009-05-27 Thread Mk 27

Julian Leviston wrote:
> Yes, you should store simply an array of ID's, not the entire objects.
> An ID (integer) is about 4 bytes or so from memory, so it won't be
> terribly much information...

This seems a terrible flaw* to me then: how am I supposed to store this 
kind of data?  I cannot use a normal global, instance, or class variable 
as these could become confused if multiple users are accessing the 
service at once.  Am I supposed to create a new, temporary per user 
database -- and how would I do that?

I guess I could keep track of the search terms that produced the list 
instead of the list itself, then when a sort is selected, reapply the 
search and then sort.

*but maybe not surprising considering the nature of the html/http beast.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Cookie overflow?

2009-05-26 Thread Mk 27

I altered a controller to use a session variable in place of an instance
variable, and this happened

Status: 500 Internal Server Error
ActionController::Session::CookieStore::CookieOverflow

In the docs, it does say:

"If you have more than 4K of session data [...] pick another session
store."

What does the phrase "pick another session store" mean?  My purpose in
doing this is to keep track of a list assembled by the user.  If the
user then chooses a sort option, I need to sort the list as it exists.
AFAIK there are no other ways to doing this.  I know nothing about
cookies; does matter how big they are?

And, of course, how can I solve my problem?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Use of global variables...

2009-05-25 Thread Mk 27

Matt Jones wrote:

> 
> Not to be snarky, but this seems to describe a session variable
> perfectly...
> 
> --Matt Jones

Yep, that's exactly what I wanted, the equivalent of a global hash. 
Evidently this is implemented with cookies.

Long live snarky!

Thanks Fred too for the reference.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Use of global variables...

2009-05-24 Thread Mk 27

Matt Jones wrote:

> 
> Not to be snarky, but this seems to describe a session variable
> perfectly...
> 
> --Matt Jones

Well thanks Matt for waiting until I had spent the afternoon re-writing 
my code to use instance variables (just kidding).

Actually, having no professional web dev experience, it occurred to me 
that maybe this is what cookies would be good for*.  At any rate, I was 
probably jumping the gun a little (or getting derailed, haha) in my 
ambitions for learning project #1.

I just googled "Ruby on Rails session variable" and found virtually no 
info, so I still don't know what this refers to.  It does not come up in 
the searchable API either, but I imagine they are in there -- can anyone 
point me to the spot?  Otherwise I will just have to wait for the books 
I requested at the library to roll in next week...

thanks again and in advance, MK

*Page caching is definitely not the thing.  I need to keep track of what 
has happened on the page -- ie, all the relevant data is there in front 
of the user.  KEY QUESTION: Where would I start if I wanted to grab and 
parse the "raw" page in it's current state?

I was also thinking I could keep a hidden form, but the former (parse 
the page) would be preferable if possible.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: != not working in search query (thinking sphinx)

2009-05-24 Thread Mk 27

Looks like I am one step ahead of you Sam, I learned this one yesterday:

http://www.ruby-forum.com/topic/187676#new

Look a few posts down for the series of "67 != 67"

Anyway, the problem is that w/ a HTTP request everything is received as 
a string. So:

account_status.to_i


-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Preloading database tables

2009-05-24 Thread Mk 27

ms wrote:
> Thanks for your answer, I'll explain: I've got my migrations where I
> can set up the table layout. Afterwards I want to fill this database
> with some predefined records. These records should lay somewhere else
> in simple text files, CSV, XML or whatever. It's just about to divide
> the table definitions and the data I want to add directly after the
> creation.
> 
> Thanks for your help,
> ms

You can create a database anyway you like and use it to replace the 
(empty) one initially created -- as long as all the table and column 
names match, of course.  You can even do that while the server is 
running. Also, every table must have a column "id" which is the INTEGER 
PRIMARY KEY, and this should be a unique number for each row.  Table 
names should correspond to controller class names.  They should be 
plural and capitalized*, eg, if you have an app/views/document (and an 
app/controllers/document_controller.rb), you will need a table in your 
database called Documents which corresponds to the entry in 
db/schema.rb.

Is that what you mean?


*they may not have to be since they are not in the schema -- anyway, 
when I've done this they were capitalized and it works fine.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Preloading database tables

2009-05-24 Thread Mk 27

Not sure what a fixture is; do you mean you want two seperate db files, 
or do you mean you want to populate the database outside of rails, and 
then use it?

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Use of global variables...

2009-05-24 Thread Mk 27

Marnen Laibow-Koser wrote:
> Mk 27 wrote:
>> Marnen Laibow-Koser wrote:
>> 
>>> In this case, you should probably be using a local or @instance variable 
>>> in the controller.
>> 
>> *There is no way to do that in rails*.  
> 
> Well, if you're so sure of that, why are you asking for help? :)

Because, as they say, it is like pulling teeth sometimes :)

Actually, I didn't really believe that, but after doing a little more 
research, I learned that in a production environment a class variable 
will not work either, and that it is true:

*YOU CANNOT DO THAT IN RAILS*

ie, you will have to write that data to a file of some sort, and use 
some kind of per user key to identify it.  Which sucks, but I guess that 
is life.

> Do I understand correctly that you'd like to cache a database query in 
> the controller between requests?  If so, perhaps a @@class variable is 
> the way to go here.  Or maybe Rails' built-in caching would do what you 
> need.

Thanks for ringing my head Marnen re: class variables.  I only skimmed 
thru the pickaxe book on the web last week.  My stupidity.

Perhaps this issue has been solved with the "built-in caching"?  The 
aforementioned "research" was another, similar forum thread from 2006. 
Hopefully -- then I will have to admit

*YOU CAN DO THAT IN RAILS*

So thanks again -- MK


-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Use of global variables...

2009-05-23 Thread Mk 27

Marnen Laibow-Koser wrote:

> In this case, you should probably be using a local or @instance variable 
> in the controller.

*There is no way to do that in rails*.  The database I am working with 
is not modifiable via the interface (there is no new or create method). 
I would use an instance variable (populated by the list method), but 
when I call another method referencing this variable, it is no longer 
populated:

class SomeController
  def list
  @array = Some.find(:all)
  end
  def another_method
  [don't bother referring to @array, it is empty]
  end
end

Since there are actually a variety of methods here that could have been 
responsible for the last @array, I cannot simply repeat the block in 
list and hope that @array will be what is it currently is/was when last 
applied in  a view.

Any suggestions?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Use of global variables...

2009-05-23 Thread Mk 27

Marnen Laibow-Koser wrote:

> Don't ever do that.  Forget that globals exist.  They cause problems 
> with maintainability and (I think) concurrency.

Yes, that is the CS Doctrine, and generally I agree.

However, it seems dysfunctional to me that it would not be possible (I 
promise you will never be asked to maintain my project ;).  This could 
be some kind of ruby object issue, I am as new to that as I am to rails.

After all, if globals were *that* bad, I presume

$global

a syntax for them should not exist either?

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Use of global variables...

2009-05-23 Thread Mk 27

I am using a global array to accumulate controller output as it is added
to the display, eg, when the user adds more items to a list, I add them
to the global.

However, something strange is going on when I then try and use that
global array in a controller method.  In a nutshell:

@selected = Array.new
$shown.each { |thing| puts "->#{thing}<-"; @selected.push thing; }

@selected is the array I want to produce (for simplicity, in the example
here it should be identical to $shown).  When this runs, the puts
statement output is correct, and .each iterates thru the array.

But debugging with the next line:

@selected.each { |x| puts "XXX:"+x }

@selected is nil; it is not even an Array now!  There is output from
WEBrick mentioning an "authenticity_token", altho it doesn't appear to
be an error and I don't know if it is relevent, I have not been using
this for long:

Processing MainController#bysize (for 127.0.0.1 at 2009-05-23 20:36:27)
[POST]
  Parameters: {"authenticity_token"=>"5KvBJEMB3I

Anyone know why, and if there is a work around?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Mike Rose wrote:

> and let me know if that solved the issue. It's really bad/wasteful to
> pull down all of your artists. Also, shorthand

Yeah, that is what I meant by "long winded".

*Why is there this issue with the name of a local, temporary variable?*
If the scope is only a few lines, I might as well call it "x" (which is 
why I think tmp is *unambiguous*: it indicates this variable is just 
that, and nothing more than that)...Is this just the normal "pick 
informative names" caveat, or is there more to it?  Rails is slightly 
scary...

Your "where =" line did not work -- I may have mistyped it, but this 
seems to do:

@albums = Album.find(:all, :conditions => { :artist_id => 
params[:find_id].to_i })


Most of all: Your help is much appreciated dude, THANKS!

ps.  If you have a minute, here's a little question about what I am 
about to try: I have a list on one side with all the artists.  A click 
on a list entry will put all the artist's albums in a div box on the 
other side.  Now, I want to add a menu up top with entries like "Sort 
albums by size", but I want that to apply only to the albums that are 
currently displayed.  I don't want to produce the list again and sort it 
(since I have some more complicated plans, like allowing the user to 
build a custom list in the div box); I want to try and keep a global 
variable ($shown) and process that back in the album controller. 
Hopefully this is possible -- any related tips brought to mind?




-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Hassan Schroeder wrote:

> Nope, nothing to do with Ruby -- HTTP request parameters are
> *always* strings.

That makes sense.

Thanks much everyone!

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Methodology question

2009-05-23 Thread Mk 27

Mike Rose wrote:
> [quote]:action => "atwo/list"[/quote]
> 
> that should should :controller => 'atwo', :action => 'list'
> 
> -Mike

Thanks!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Hmmm, I seem to be uncovering a more basic layer to my miscomprehension.
Thanks people, I think your input will come in handy, but bear with me 
for a minute:

Here's where I got to in trying to debug (just noticed stdout in the 
controller is the server stdout, handy).  Hence its long winded style:

[in controller method]
all=Album.find(:all)
@albums = Array.new
tmp=params[:find_id]
all.each { |rec|
  if rec.artist_id == tmp
@albums.push rec
  else puts "->#{rec.artist_id} != #{tmp}"
  end
}

Now, what I find mind boggling is some of the output:

->67 != 67
->67 != 67
->67 != 67
->67 != 67
->67 != 67
->67 != 67
->67 != 67

WHAT THE HECK?  I'm new to ruby, this seems an odd feature...I would 
guess this is about data types??!!?  Both numbers are sourced from an 
sqlite INTEGER.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Okay, I got the WEBbrick output to agree with me.  Here's the line in 
the controller now, which is still wrong:

@albums=Album.find(:all, :conditions => [:artist_id => 
params[:find_id]])

NoMethodError in MainController#list_albums
undefined method `%' for {:artist_id=>"67"}:Hash

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to pass parameters with remote_function

2009-05-23 Thread Mk 27

Mike Rose wrote:
> First off, have you 'thrown' the params hash that you get in the
> controller?
> 
> You can paste it back here if this did not help you solve your
> problem.
> 
> -Mike

Where, like "out the window"? ;)  I do not understand what you mean by 
thrown.

Here's something (else) strange (to me):  I am trying to work this out 
now with link_remote, since that's simpler until I get the nitty gritty.

<%=link_to artist.name, :action => "list_albums", :find_id => 
artist.id %>

I notice that WEBbrick output sez:

Parameters: {"artist_id"=>"65"}

Shouldn't this be passed as "find_id"  I guess I could have this 
backward, will test.  Maybe I'll also try to log output to a file in the 
controller, if rails will allow me to debug that way...

Anyway, really the best thing for me would be an example paralleling the 
OP request.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] how to pass parameters with remote_function

2009-05-23 Thread Mk 27

I cannot find a complete example of this on the web.

Here's what I'm trying to do:  In a view I have a remote_function call
that right now looks like this:

<% @artists.each do |artist| %>
   { :action => :list_albums }, :with => "id=#{artist.id}") %>">
  <%=artist.name%>
<%end%>

and in the corresponding controller:

def list_albums
 @albums=Album.find(params[:id])
 @albu...@albums.sort { |a,b| a.title <=> b.title }
end

Either or both of these is wrong, since in the end I get a "Can't find
an album without id".  There is a complicating issue, too, since if I
change the parameter name, I get "undefined local variable".

Anyone got a quick example of the syntax for what *must* be a very
common and simple task???
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Methodology question

2009-05-23 Thread Mk 27

Colin Law wrote:

> Not sure I follow you here, you can certainly link to a different 
> controller
> from a view, what is that you are trying to do?
> 
> Colin

That is what I am trying to do, perhaps this is a syntax problem.

If I have three controllers under app/, "aone", "atwo", "athree", all of 
them have a method "list", in the view for aone I want to call the list 
method from atwo, so I tried

:action => "atwo/list"


This is a no go -- what's the proper syntax?

Also (another sort of related syntax question), how can I use a 
parameter with the methods?  Here's a line which works in a view:

 { :action => "list_albums" }) %>">

and here is one which returns "undefined local variable or method 
`url'", the only difference being I tried to pass a parameter via the 
action

 { :action => "list_albums(#{artist.id})" }) %>">
^ oh no!

I tried this a few different ways and am about to try a few more ;) Is 
it just the quoting, or what?

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Methodology question

2009-05-23 Thread Mk 27

Just to clarify, artist.id would be defined in the context (since the 
text content of the  is artist.name).

I suppose I should order a book on this stuff ASAP...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Methodology question

2009-05-23 Thread Mk 27

I notice you cannot access another controller method from a view, eg.

:action => "othersec/list"

is no good; the action must belong to the corresponding controller

That being the case, I might as well just have one controller, "main", 
with methods like "list_that" and "list_this", ie, there is not much 
point in defining a controller for each table -- all that is needed is 
class definition in models/

However "what seems to be the case" to me is not necessarily the way 
that it is -- I'm worried I may diverge too much from anything 
resembling *Best Practices* here, particularly since this means going

script/generate controller this
then erasing everything but the model definition (I tried erasing those 
two, and creating one "main.rb" with all the classes in, but then there 
is an error).

Anyone have any thoughts on this?  After a bit of googling I found some 
stuff about inheritance governing this -- does that mean I should put 
the methods I want globally accessible in 
app/controllers/application_controller.rb?

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Methodology question

2009-05-23 Thread Mk 27

Still learning, but it is getting easier by the minute ;)

I have a bunch of controllers (that correspond to db tables) and
corresponding views.  However, I want to use the views with
link_to_remote into divs on a page that is created as a "base" that is
loaded WITHOUT making any calls on the db.  To this end I created a dud
controller, main, with a single empty method

def load
end

and a corresponding view that is the html "base".  This works fine, but
I wanted to check and see if there are any caveats against doing this
(using a seperate dud controller) or if there is a more "conventional"
way to go.

I could put the empty method into a real, existing controller, I just
figured "main/load" would be tidier...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: modifing db

2009-05-21 Thread Mk 27

E. Litwin wrote:
> The id should be an auto-incrementing primary key.
> Also, column names should be lower cased using an underscore to
> separate words, i.e. first_name
> You should also consider adding "created_at" and "updated_at" datetime
> fields to handle timestamps.
> 
> Table names should be pluralized.

Thanks.  I just realized I confused this post with one I forgot writing 
yesterday.  This looks like the info I need.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to import db

2009-05-21 Thread Mk 27

Manasi V1 wrote:
> Hi..
> I have a similar system where my source db is legacy Oracle db. What I 
> have done is use MySQL db for development and Oracle in other 
> environments..You will need the schema for setting up local. Don't 
> import the db at one go.. Create migrations as you establish models and 
> associations for the app..
> you can use SQL scripts if you want soem raw test data.
> 
> Thanks

Actually this was just for learning purposes.  I don't really want to 
sit and manually add entries in a browser -- I'd like a decent size 
database to play with while I get used to API.  So I'm writing a short 
ruby script to collate some filesystem data into an sqlite3 file.  Which 
shouldn't take much longer, hopefully everything will be okay.  If not I 
will just pull the rails "development.sqlite3" file out and add to that 
(I guess that's really what I should be doing...).  I'm using the same 
fields as in the schema, plus "id", which AFAICT is just an int count 
(1,2,3...).

So I was wondering if there are any caveats about this. (It's a 
pre-emptive post; the next one will be "Whhaaa...Why won't the database 
I made work in rails?") ;)

MK
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: another quick question, or two

2009-05-21 Thread Mk 27

Marnen Laibow-Koser wrote:

> Learn how routing works in Rails (the rdoc is excellent on this topic). 
> That's the only real answer that I or anyone else can give you.

Okay...thanks for the explanation
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] modifing db

2009-05-21 Thread Mk 27

If I am going to build a sql database for use in rails (rather than
building it in rails), is there anything I need to know beyond using an
id column in every table?  Does the id need to be the "primary key"?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: another quick question, or two

2009-05-21 Thread Mk 27

Marnen Laibow-Koser wrote:
> Mk 27 wrote:
>> If I want to link from/redirect via the index page (which I notice will
>> not process as erb)
> 
> Huh?  *What* won't process as ERb?

public/index.html

I copied my (working) application.html.erb from app/layouts, made some 
appropriate modifications, and named it "index.html.erb".  When I start 
the server and go to localhost:3000, it does read the page but it spits 
out the <%ruby%> unparsed, like I suppose it would if I used apache.

Anyway, I am sure I will get to know all the rails commands eventually, 
but since all the paths are absolute relative to one another, I would 
actually PREFER to know what they are/should be -- you cannot get 
simpler than typing a relative url, eg. it would literally be 
"app/views/section/list" (although this does not work).  Ease of use is 
one thing, pointless opacity is another.

So, can I ask that question again in the hopes of getting a real answer? 
I will investigate url_for and routes as well...
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] another quick question, or two

2009-05-21 Thread Mk 27

If I want to link from/redirect via the index page (which I notice will
not process as erb), what's the local relative path I should use to the
the view (object/method don't work)?

I am getting to like rails so I will probably stick with it.  Does
anyone have anything to say (pro and contra, please) about the various
"Ruby on Rails" books that are available?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rake redo??

2009-05-20 Thread Mk 27

Frederick Cheung wrote:

> rake tasks are arbitrary ruby code. in theory you could have a rake
> task that launched a missile at the moon. The tasks that rails
> provides in the db: namespace do just fiddle with the database (or
> related files like schema.rb)
> 
> Fred

Thanks all!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] rake redo??

2009-05-20 Thread Mk 27

Being someone who likes to write code and do everything myself this
rails deal has me grinding my teeth, but I will get over it.

I just noticed after doing a "rake db:migrate" that I mispelled a
method/column name.  So before doing anything else, I corrected the
spelling in the relevant db/migrate .rb file and ran "rake db:migrate"
again hoping that would do.  However, looking in the db/schema.rb file,
nothing had changed.  So I erased that and the database and tried rake
again and hopefully everything is fine BUT that is hackish, to say the
least.

I've only glanced through the rake docs, --help, etc, and can't find
anything pertinent to the issue.  Anyone nice wanna explain quick?

The other part of my question: does rake affect anything outside db/ ?
If not, everything should be hunky dory.

Right?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Misgivings (or misconceptions?) about class=table concept

2009-05-20 Thread Mk 27

Marnen Laibow-Koser wrote:

> Does that make more sense?

Yep.  Thanks much.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Misgivings (or misconceptions?) about class=table concept

2009-05-20 Thread Mk 27

Please bear with me as I am totally new to Rails AND sql.

Let's say a want a database & application for a record collection (using
sql and rails).  If I want the database to contain information down to
the length of a song, how can I implement this using the class = table
model?

For example, the way I have the db now, ignoring rails, is a table "of
Contents" listing all artists (one column).  Each artist then has a
table listing all their albums, several columns since we want the total
length of the album and (since this is a digital catalog) a location
where the actual album is stored.  Then we need a table for each album
listing each song, with the length.

Going with the class=table model, that means I will be stuck with a
separate class for every single artist and album, which is beyond
ridiculous if not completely unworkable.  But if I organize the material
differently -- eg, a table "artist" with a column "albums" (fine, if
they were just objects) some single table cell would have to contain a
list of all the albums.  Slightly awkward,  since each album will then
have to be parsed out of a string of albums, but more realistic.  Then I
would have a table "albums" with columns/methods "artist" and "songs".
But when it comes down to including the length of each song, this
methodology is gonna get dunder-headed.

The former model makes much more sense anyway, from any perspective
*except* it would appear to be unworkable with rails.  Clearly I am
missing something here, I hope.  Anyone want to offer me a clue?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] how to import db

2009-05-20 Thread Mk 27

I'm just starting out learning.  So far, all I've done is little test
apps starting from scratch -- ie, ones in which rails creates an empty
database, then I make up some classes and views and controllers and
such. Nice system. But what if I have an SQlite database file created
elsewhere:  (how) can I import this into ruby "easily"?  I have not
tried yet because it just occurred to me that there is an id
field/column in the "native" rails databases.  Could I add such a column
and then just copy the db file straight into db/development.sqlite?

I am guessing the easiest way might be to just create an empty db with
all the necessary tables and columns and then write a script to copy the
relevant data in from the existing external db.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Hosting small site on Windows temporarily

2009-05-19 Thread Mk 27

8bit wrote:

> While I begin to pimp my RoR knowledge, I'd like to keep things as
> simple as possible here.  

Sorry, the devil made me do it.  Just repeate all this to the customer 
and it won't matter what server you use ;)

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails Error explained?

2009-05-19 Thread Mk 27

Julian Leviston wrote:
> I thought you meant API.rubyonrails.org
> 
> Which server errors?

It was because of the link in the post (don't use <>?), I just tried the 
actual address and that looks good.  THANKS.

Also thanks Fred for the "guides"

 :
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails Error explained?

2009-05-19 Thread Mk 27

Hassan Schroeder wrote:

> Anyway, see: 
> 
> --
> Hassan Schroeder  hassan.schroe...@gmail.com

This is a dead link.  I presume you mean the same thing that's at 
localhost:8808?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails Error explained?

2009-05-19 Thread Mk 27

Julian Leviston wrote:

> Re: the API, why can't you use your browsers search feature?
> Everything is on the one page - in frames.

That's totally wacked.  The API I am referring to involves quite a few 
seperate files in usr/local/lib/ruby/doc/.  There would be not much 
purpose to frames if they were not multiple pages.  Most html'ified API 
documentation does not have a search function, I was just hoping for a 
bit more from ruby ;)

Mostly my complaint would be that there does not seem to be anywhere 
describing the meaning of the server errors.

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Speed up recursive loop or get rid of it?

2009-05-19 Thread Mk 27

Morgan Morgan wrote:

> it's basically just a calendar view from 8am to 12pm with colours for 
> each of the schedule types returned
> 
> so it's a grid

Can you change the model then?  It sounds like something easier done the 
other way around, ie, you iterate through the things that are scheduled 
for when they are scheduled, and get rid of the calendar in the model -- 
just implement it in the view based on the database of things scheduled.

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to handle javascript with watir

2009-05-19 Thread Mk 27

Lucas wrote:
> html code:
> 
>   document.write(' type="password" maxlength="20" size="32" tabindex="2"/>)
> 

Someone warned me yesterday that the language="javascript" part is 
deprecated and should no longer be used. So I thot I'd pass that on.

But sorry, I've never used watir.  A shot in the dark would be to say 
that 90% of this kind of thing involves the id=
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails Error explained?

2009-05-19 Thread Mk 27

Mk 27 wrote:

> I can't seem to find any reference anywhere to an explanation of what
> these errors actually mean (perhaps it has to do with manually adding a
> view?  The file just contains the words "Hello World"), altho there are
> a few old posts about how to "turn it off".

Well adding this to the controller worked:

protect_from_forgery :only => [:create, :update, :destroy]

Also very disappointed that a *web interface* API does not include a 
search function (!), meaning I had to use grep on the doc source -- 
which is very awkwardly laid out from a "grep" perspective.

I guess you can't ask for everything.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Rails Error explained?

2009-05-19 Thread Mk 27

I just got my first error, "ActionController::InvalidAuthenticityToken".

I can't seem to find any reference anywhere to an explanation of what
these errors actually mean (perhaps it has to do with manually adding a
view?  The file just contains the words "Hello World"), altho there are
a few old posts about how to "turn it off".
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: first day on rails...and already hamstrung!

2009-05-18 Thread Mk 27

Hassan Schroeder wrote:

> 1) the language attribute is not only not "necessary", it's deprecated;
> don't use it.

Thanks.

> 
> 2) spell text/javascript correctly and it should work as intended.

Sheesh.  New things make me crazy paranoid.

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



  1   2   >