[Rails] Javascript in a partial

2009-07-29 Thread JannaB

If I have js in a partial, and my controller calls render :partial =>
'...' will that js then be executed?
--~--~-~--~~~---~--~~
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] authenticity_token

2009-07-27 Thread JannaB

How can I override the need for the authenticity_token or bypass it
altogether? -Janna B
--~--~-~--~~~---~--~~
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: Routes from raw js (using XMLHttpRequest)

2009-07-27 Thread JannaB

Oh, wait, I need to pass the parameter of the authenticity_token to
the url. How can I do this? -Janna

On Jul 24, 10:18 am, bill walton  wrote:
> On Fri, 2009-07-24 at 05:09 -0700, JannaB wrote:
> >  it is posting somewhere and I believe that because in firefox,
> > the error concole is clean.
>
> The console tab in the Firebug plugin is what you want to be looking at.
> It will tell you if / where your app is making requests and the
> parameters it's passing.
>
> HTH,
> Bill
>
> > Can someone tell me from my js below where I am
> > posting, or why my controller method isnt getting the post? Thanks,
> > Janna B
>
> > //this function is getting called by an onchange in the associates
> > select
> >  function assocchange(therow){
> >    var s = document.getElementById("assoc"+therow).value;
> >    var url = "/channels/assocboxchange/"
> >    var parameters = "assoc=" + escape(encodeURI(s)) + "&id=" + therow;
> >    formid="assoc" + therow;
> >    makePOSTRequest(url, parameters, formid)
> >   }
>
> >   function makePOSTRequest(url, parameters, formid){
> >    req3 = new XMLHttpRequest();
> >    if (req3) {
> >      req3.onreadystatechange = alertContents(formid);
> >       req3.open('POST', url, true);
> >       req3.setRequestHeader("Content-type", "application/x-www-form-
> > urlencoded");
> >       req3.setRequestHeader("Content-length", parameters.length);
> >       req3.setRequestHeader("Connection", "close");
> >       req3.send(parameters);
> >    }
> >   }
>
> >   function alertContents(formid) {
> >     if (req3.readyState == 4) {
> >      if (req3.status == 200) {
> >         result = req3.responseText;
> >            document.getElementById("'"+formid+"'").innerHTML =
> > result;
> >      } else {
> >         alert('There was a problem with the request.');
> >      }
> >     }
> >   }
--~--~-~--~~~---~--~~
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: Routes from raw js (using XMLHttpRequest)

2009-07-27 Thread JannaB

Oh, wait, I need to pass the parameter of the authenticity_token to
the url. How can I do this?
--~--~-~--~~~---~--~~
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: Routes from raw js (using XMLHttpRequest)

2009-07-25 Thread JannaB

What a great tool. When I click the select box, in firebug, I see a
RED:

POST http://localhost:3000/channels/assocboxchange/

with a littel red circle with a white X in it. IF I look at the
parameters, those seem to be passed properly.

In my ChannelsController, I have:

 def assocboxchange
puts "you;re in"
render :action => 'display'
  end

Which doesn;t get hit -- obviously, that red POST line is trying to
tell me something is wrong...but what? -Janna B
--~--~-~--~~~---~--~~
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] Routes from raw js (using XMLHttpRequest)

2009-07-24 Thread JannaB

I am making an ajax call from js to call a method (assocboxchange) in
my controller (AssociatesController),  using XMLHttpRequest. I know
the  XMLHttpRequest works fine because I use it in other places with
success. My problem is my URL I am using for this request doesn;t
access the method in my controller which I (think) I am specifying. I
am having it post to /channels/assocboxchange/" with certain
parameters, but the method in my controller never is gotten to. I know
the problem is not in my js or in making the post request -- it is
posting somewhere and I believe that because in firefox, the error
concole is clean. Can someone tell me from my js below where I am
posting, or why my controller method isnt getting the post? Thanks,
Janna B

//this function is getting called by an onchange in the associates
select
 function assocchange(therow){
var s = document.getElementById("assoc"+therow).value;
var url = "/channels/assocboxchange/"
var parameters = "assoc=" + escape(encodeURI(s)) + "&id=" + therow;
formid="assoc" + therow;
makePOSTRequest(url, parameters, formid)
  }

  function makePOSTRequest(url, parameters, formid){
req3 = new XMLHttpRequest();
if (req3) {
  req3.onreadystatechange = alertContents(formid);
  req3.open('POST', url, true);
  req3.setRequestHeader("Content-type", "application/x-www-form-
urlencoded");
  req3.setRequestHeader("Content-length", parameters.length);
  req3.setRequestHeader("Connection", "close");
  req3.send(parameters);
}
  }


  function alertContents(formid) {
if (req3.readyState == 4) {
 if (req3.status == 200) {
result = req3.responseText;
document.getElementById("'"+formid+"'").innerHTML =
result;
 } else {
alert('There was a problem with the request.');
 }
}
  }
--~--~-~--~~~---~--~~
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: Why does this output to the console?

2009-07-17 Thread JannaB

so to use your statement, I should put the following in my Associate
model?

belongs_to :watching_channel, :class_name => "Channel", :foreign_key
=>
"watching_channel_id"

-Janna B

On Jul 17, 1:09 am, Rodrigo Dominguez  wrote:
> Janna Brossard wrote:
> > yes, current_associate.watching_channel_id IS a foreign key to
> > channel.id. But I have not specified it as such in the associate model
> > or the channel model (not sure how -- or if I even need to!) -Janna
>
> if the class name is WatchingChannel, the it will work
>
> belongs_to :watching_channel
>
> if the class name of the watching channel is something else, like
> Channel, then it will work
>
> belongs_to :watching_channel, :class_name => "Channel", :foreign_key =>
> "watching_channel_id"
>
> it's always false because either @channel is not null, the foreign key
> is not null or the foreign key is zero.
>
> Note that you should never have a foreign key with a zero value
>
> If you make the modification in your model, you can easily do
>
> if �...@channel.nil? and current_associate.watching_channel
>
> and finally
>
> @channel.nil? and @channel == nil is almost the same thing,
> @channel.nil? is easier to read, dough
> --
> Posted viahttp://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: Why does this output to the console?

2009-07-16 Thread JannaB

yes, current_associate.watching_channel_id IS a foreign key to
channel.id. But I have not specified it as such in the associate model
or the channel model (not sure how -- or if I even need to!) -Janna

On Jul 16, 8:56 pm, Nicholas Henry  wrote:
> I'm not sure, but you probably should rewrite that:
>
> if @channel.nil? && !current_associate.watching_channel_id.nil? &&
> current_associate.watching_channel_id > 0
>
> better still why are you checking if watching_channel_id is gt 0? Is
> watching_channel_id a foreign key for an association for watching
> channel? then you could do this:
>
> if @channel.nil? && current_associate.watching_channel
>
> Sorry I couldn't specifically answer your question, but hope the code
> review was useful.
>
> Cheers,
> Nicholas
>
> On Jul 16, 7:47 pm, JannaB  wrote:
>
> > Why would a particular line:
>
> > if @channel == nil && current_associate.watching_channel_id != nil &&
> > current_associate.watching_channel_id > 0
>
> > alsways output the statement:
>
> > false
>
> > to the console
>
> > I am using Rails 2.3.2 -Janna B
--~--~-~--~~~---~--~~
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] Why does this output to the console?

2009-07-16 Thread JannaB

Why would a particular line:

if @channel == nil && current_associate.watching_channel_id != nil &&
current_associate.watching_channel_id > 0

alsways output the statement:

false

to the console

I am using Rails 2.3.2 -Janna B

--~--~-~--~~~---~--~~
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: Redbox

2009-07-15 Thread JannaB

No, sorry...I'm not even to that point yet. I am using Authlogic and I
am not even sure how to compare username/password to validate it,
without changing the current user.

On Jul 15, 5:29 am, Sandip Ransing  wrote:
> Hi janna,
>
> I am using thickbox for changing user's password.
> but what happens,
> after posting form,  when error occurs ( i.e. password n confirmation
> mismatch )
> response does't come back to thickbox.
> it goes to normal html page.
> do you have any idea on this ??
>
> Thanks,
> Sandip R~
--~--~-~--~~~---~--~~
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: Redbox

2009-07-14 Thread JannaB

Solved my own problem.had an outdated version of the plugin.
Posting here in case someone hits this in the future via a search on a
similasr problem. Got the latest version of the plugin by:

git://github.com/craigambrose/redbox.git
--~--~-~--~~~---~--~~
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] Redbox

2009-07-14 Thread JannaB

I'm trying to do a simple submission using the redbox plugin. However,
the fields for the form  I want to display appear properly in the
center of the page, the background box created by redbox (with the
spinner gif) does not. It always appears at the top center. This isn;t
a scrolling issue because the page isn;t long enough to scroll. Also,
I have the proper js and css files being called and in the right
locations. Is anyone familiar enough with redbox to tell me why my
contents appear in the proper location, but the pseudo-modla dialog
box of redbox does not, appearing at the top center? Thanks, Janna B.

<%= link_to_redbox((image_tag "/images/lockclosed.gif"),"redbox") %>




<% form_for :associates, :html => {:name => 'lockform'} do |f|
%>
<%= f.label :username, "username: " %>
<%= f.text_field :username %>   
<%= f.label :password, "password: " %>
<%= f.password_field :password%>

<%= f.submit "Submit" , :class=>'button' %>

<% end %>
Close
   
 


--~--~-~--~~~---~--~~
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] Replicating link_to_remote in raw js

2009-07-13 Thread JannaB

This is an interesting problem:

I have a view that has a div that gets replaced by innerhtml using a
settimer() in js.

The settimer() invokes a js function (makemytable())that creates a
table in html based on json data that gets written on the server every
2 seconds.

So, every 2 seconds, the table in the div in the view automatically
updates itself. So far, tres bien, very good.

Now, I need to put links in some of the cells in the table -- but I
want them to be effectively link_to_remote's.

So waht I need to do is, since this innerhtml is finished html/js and
not ruby code, I need to put these link_to_remotes in in a pure js
manner from within makemytable(), which is itself a js.

So my question, the must be a way within js to replicate what
link_to_remote creates, no? How can I write out the finished page, in
effect, with links that operate like link_to_remote? Does anyone know
what that looks like? If I simply look at the source of a page I have
with a link_to_remote on it I see:



I assume I only need copy this text, altering what needs to be altered
interms of where I wantt it to call, etc. But what is the
authenticity_token? I am using AUthLogic plugin, could it be from
that?. Is that necessary here to put that text  in too? -Janna B


--~--~-~--~~~---~--~~
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: Ways to chart data in Rails?

2009-07-12 Thread JannaB

But frankly, it really appears to me that fusion charts is the best
looking. Am I mistaken? Do you guys see a better open source solution?
-Janna B
--~--~-~--~~~---~--~~
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: observe_field on text_field

2009-07-12 Thread JannaB

And when I get rid of my observe_field in my partial...this error goes
away, so clearly the error is related to the js created by
observe_field (even if by my not getting good parameters into it).

So now I just need to figure out an alternative to observe_field. It's
a pity ruby doesn have an observe field in a db. There must be a gem
for that? If I can;t get observe_field to work on a simple text box, I
need to find an alternative way of doing this.
--~--~-~--~~~---~--~~
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: observe_field on text_field

2009-07-12 Thread JannaB

I dont see anything in firebug that shows me what happens on a get or
post -- just the static snapshot of the page in a nice, expandable
tree view. HOWEVER, I do notice in my mongrel monitor window when I
submit the form I get the following (I have NO idea what this means!
But I am certain it is at the root of my problems):

Mon Jul 13 00:26:25 -0400 2009: Read error: #
G:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/
bin/../lib/
mongrel/http_response.rb:137:in `write'
G:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/
bin/../lib/
mongrel/http_response.rb:137:in `write'
G:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/
bin/../lib/
mongrel/http_response.rb:95:in `send_header'
G:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/
bin/../lib/
mongrel/http_response.rb:146:in `finished'
G:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/
bin/../lib/
mongrel.rb:165:in `process_client'
G:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/
bin/../lib/
mongrel.rb:285:in `run'
G:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/
bin/../lib/
mongrel.rb:285:in `initialize'
G:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/
bin/../lib/
mongrel.rb:285:in `new'
G:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/
bin/../lib/
--~--~-~--~~~---~--~~
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: observe_field on text_field

2009-07-12 Thread JannaB

Bill,

Sorry, it;s because I wrote the last post while playing around with it
trying to experiment (I really only have one version on this
system).BUT, "associate_inoutexplanation" is the id of the text
field I am trying to observe, as well as what I put into my
observe_field to observe it. The partial itself creates the following
html where you can see the associate_inoutexplanation as both the
input field's id and the javascript created by my
observe_field "associate_inoutexplanation", :url => {:controller
=> ...
in my partial. Below is the html created.can you see why the
observer is not passing on to /channels/
speakassfromwhereaboutspartial ? -Janna B


 
 
   Hello Ralph Vince
please update your whereabouts || tell us what you're doing:
   
   
   
//




 



--~--~-~--~~~---~--~~
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: observe_field on text_field

2009-07-12 Thread JannaB

Many Thanks  Bill.

First, here is what shows in firebug for that partial which creates a
form:








Hello
Janna
please update your whereabouts || tell us what you're doing:





1
2//
5




So far so good. Now, I update the text field, submit, and look at it
again in firebug:








Hello
Janna
please update your whereabouts || tell us what you're doing:





1
2//
5




Notice that the value for the message has changed in the textfield, of
course, but the action I am trying to call
channels.speakassfromwhereaboutspartial, doesn't get called, because
in it I have a puts statement:

  def speakassfromwhereaboutspartial
puts "speakassfromwhereaboutspartial"
boxchangedata
puts params['associate_inoutexplanation']
   offToServer 0,current_associate.username,
current_associate.username, "@speakass
"+current_associate.channelselectedassoc,:channelnotes => params
['associate_inoutexplanation']
  end

So it appears that somehow my observe_field is not observing -- or
likely not observing what I want it to! -Janna
--~--~-~--~~~---~--~~
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: observe_field on text_field

2009-07-12 Thread JannaB

Bill,

Thank you for your pointers regarding Rails-like idioms, etc. Coming
from a Java background, I really want to break from that and do things
in the Rails manner, and I appreciate your pointing this out (things
like .blank, etc.)

As for my observer_field, I don;t follow you when you say the field
doesn;t exist and will never fire. The field with id of
'associate_inoutexplanation' does exist (what am I missing here in
what you are saying in this regard?) I have enclosed the relevant
portion of the firebug output which I have copied here:




1
2//
5



-Janna B
--~--~-~--~~~---~--~~
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: Ways to chart data in Rails?

2009-07-12 Thread JannaB

I have found a site whose charts I would like to emulate. The cahrts
come up with a kind of smooth, animated look to them. If I go to:
https://www.pipelinedeals.com/
and click "thry the demo," a flash presentation of it comes up. I am
wondering if anyone knows what off-the-shelf package they are using
for this. It;s the best looking charts I;ve seen. -Janna B
--~--~-~--~~~---~--~~
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] observe_field on text_field

2009-07-12 Thread JannaB

I've implemented observe_field succesfully on other controls, but
never on a text field. For whatever reason, the following partial
never executes the action specified in the url of my observe_field
below.

Does anyone see what I am doing wrong here and how I can make that
action fire? Thanks, Janna B.

<% form_for current_associate, :html => {:name => 'whereaboutsform'}
do |f| %>
   <%= f.label :inoutexplanation, "Hello " <<
current_associate.nice_to_s << " please update your whereabouts or
tell us what you're doing:" %>
   <%= f.text_field :inoutexplanation %>
   <%= f.submit "Update" , :class=>'button' %>
   <% if current_associate.channel_id != nil and
current_associate.channel_id > 0 %>
   <%= observe_field "associate_inoutexplanation", :url =>
{:controller => :channels, :action =>
'speakassfromwhereaboutspartial' },  :with =>
"'associate_inoutexplanation=' + value" %>
   <% end %>
<% end %>
--~--~-~--~~~---~--~~
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: Nested forms

2009-07-11 Thread JannaB

Im ok with the controller / model architectureit;s the UI itself
that I am trying to accomplish. Simply, a means to collapse forms on
the screen is reallyt what I want. Thanks! Janna
--~--~-~--~~~---~--~~
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] Nested forms

2009-07-11 Thread JannaB

Can someone please point me in the right direction on what to do here,
in terms of basic architecture. I;ve seen this type of interface
before.

Let's say I have something that is "sold" and I have a form for the
sold information. At the bottom of the form, say, us a little "plus
sign" or something like that, with a notation after it that says
"Customer", which then opens up another form, embedded in the sold
form (in terms of the UI) to enter possible customer information for a
second form, and that customer form may have another form embedded in
it with a plus sign, etc. When I submit on an embedded form, it
closes, taking me to its enclosing form, with a plus sign where the
one I just submitted was.

The basic idea therefore is to
1. conserve screen space
2. not require you to redirect to another page for a form which is
linked to by it;s enclosing form

Is there a standard library for this type of thing? (Im open to any
ideas that satisfy these two points mentioned) If not, can you tell me
how to create it? Thanks, Janna B
--~--~-~--~~~---~--~~
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: conditional link_to_remote not re-rendering

2009-07-11 Thread JannaB

You knowyour sharing of your knowledge on here...I can read all
day long on Ruby, and I can write code all day long -- but when you
(and a few others on this list as well) point out what should be
obvious (errors) to me, it REALLY sinks in, and my understanding of
this grows exponentially, and I am obligated in the future to
contribute to others questions as my knowledge level increases.

I really cannot thank you -- and the others here who help, enough. -
Janna B
--~--~-~--~~~---~--~~
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: conditional link_to_remote not re-rendering

2009-07-11 Thread JannaB

[Do not hit {tab} while attempting to post!]

continuing, the point is, it does NOT rerender that partial / div
even though the controller code is being executed properly. Isn;t this
the way I should do something though for link_to_remote when what I
want to update contains the html portion that calls it? -Janna B
--~--~-~--~~~---~--~~
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: conditional link_to_remote not re-rendering

2009-07-11 Thread JannaB

Fred, I put the whole div with the link_to_remote's  in it's own
partial:


<% if @channel.floorfrozen != 0 %>
<%= link_to_remote image_tag("/images/icecube.gif"), {:url =>
{:controller => 'channels',:action => 'freezer', :update =>
'buttonrak1'}},:title => 'Unfreeze the floor', :type =>
"submit",:style => "float: right; border-style: groove; padding: 1px;"
%>
<% else %>
<%= link_to_remote image_tag("/images/icecube.gif"), {:url =>
{:controller => 'channels',:action => 'freezer', :update =>
'buttonrak1'}},:title => 'Freeze the floor', :type => "submit",:style
=> "float: right; border-style: ridge; padding: 1px;" %>
<% end %>


Then, in my controller, I re-render the partial (i.e. the div with the
link_to_remotes):

def freezer
###blah blah
render  :partial => 'brack1partial'
  end
--~--~-~--~~~---~--~~
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: conditional link_to_remote not re-rendering

2009-07-10 Thread JannaB

I'm stumped here -- well aware that link_to_remote is intended to do
something other than what I am trying to use it for. You see, I need
to create a sort of button, that takes an image and that has different
looks (css styles, depending upon the state of a variable), that works
without rendering a page.

God. Does anyone know any way I can accomplish this? It SEEMS like it
is easiest solved as a rails solution because of the Ajax helpers
inherint in Rails -- but I am open to anything! -Janna B
--~--~-~--~~~---~--~~
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] conditional link_to_remote not re-rendering

2009-07-10 Thread JannaB

I have an int, 'floorfrozen,' in my table, 'channels' that can take a
value of 0 or 1.

When I render a page, an image in a link_to_remote is called
differently depending what the value of channel.floorfrozen is, in a
partial, as follows:

<% if @channel.floorfrozen %>
<%= link_to_remote image_tag("/images/icecube.gif"), {:url =>
{:controller => 'channels',:action => 'freezer'}},:title => 'Unfreeze
the floor', :type => "submit",:style => "float: right; border-style:
groove; padding: 1px;" %>
<% else %>
<%= link_to_remote image_tag("/images/icecube.gif"), {:url =>
{:controller => 'channels',:action => 'freezer'}},:title => 'Freeze
the floor', :type => "submit",:style => "float: right; border-style:
ridge; padding: 1px;" %>
<% end %>

The problem is that the image remains the same! The functionality of
what is occuring in the the controller action, channel.freezer, is
correct, but the link_to_remote never rerenders UNLESS I refresh the
page. Can somene tell me why this is and how I can fix it so that my
page renders properly? Thanks, Janna B.

def freezer
  if @channel.floorfrozen == 0
  @channel.update_attributes(:floorfrozen => 1)
  @channel.floorfrozen = 1
else
 @channel.update_attributes(:floorfrozen => 0)
 @channel.floorfrozen = 0
end
render :action => 'display'
end
--~--~-~--~~~---~--~~
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] observe_field on select

2009-07-09 Thread JannaB

I have an observe_field on a select box. All works well,
EXCEPTthis particular select box is a js masterpiece that allows
it to be editable in selection index 0.

My problem thus is if someone selects the 0th item in the select box,
types in a value, the observe_field still picks it up in my controller
as "" for params['channelnotes'].

Is there a way to amend the observe_field to send back whatever the
text is in the select box? (and not just when the user clicks on it to
invoke the change, because then, of course, option 0 text is "") I
need to somehow just pass the text of the selected item in it whenever
the text itself changes. Does anyone know observe_field on select
boxes well enough to know how to do this? -Janna B

 
  
  one
  two
  three


<%=  observe_field "channelnotes", :url => {:controller
=> :channels, :action => 'notesboxchange' }, :with => 'channelnotes' %>
--~--~-~--~~~---~--~~
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: observe_field value in controller

2009-07-09 Thread JannaB

THanks Bill, yes it works now as:

<%= observe_field "channelnotes",
> :url => {:controller=> :channels, :action => 'notesboxchange'} , :with => 
> 'whatever_you_want_the_parameter_key_to_be_named'

--~--~-~--~~~---~--~~
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: Managing and presenting large amounts of up-to-date data...?

2009-07-09 Thread JannaB

For what it's worth, I am presenting tabular data in an ajaxian manner
using settimer and json, gethering the data and putting it out with
innerhtml. I think you could do the same with graphical data. I'll
gladly send you the javascript I have for doint this if you want. -
Janna B

On Jul 9, 4:56 pm, gberz3  wrote:
> Hi All,
>
> I'm in the midst of a Rails application that produces line,bar, and
> pie charts for constantly accumulated data.  That said, I'm looking
> for some quality ways in which to deal with presenting the large
> amounts of data while keeping the graphs accurate and up to date.
> Obviously the simple answer is to build and run a new query each and
> every time a chart is accessed.  However, my gut tells me that there
> are frameworks/libraries, etc. that can manage this -- perhaps in the
> background.  Any thoughts?
>
> For the record, I am using XMLSWF charts (http://www.maani.us/
> xml_charts/).
>
> Best.
--~--~-~--~~~---~--~~
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: New to Rails? Read This

2009-07-09 Thread JannaB

Thanks for this post. I too am coming into this new (except for a
heavy Java background) and the onyl thing I would add to your list is
this newsgroup. My personal goal here is to keep learning, hopefully,
be able to answer other people's questions on this newsgroup. -Janna B.
--~--~-~--~~~---~--~~
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: submit_to_remote with image

2009-07-09 Thread JannaB

Fred,

I thnk you may be wrong on this (for once!) -or-, more likely, I cant
find the right hash key for the image (I'm unable to discern the
correct syntax).
For example, the following works, but, my problem is that it doesn't
pick up the values of other controls on the form:

<%= link_to_remote image_tag("/images/icecube.gif"), {:url =>{:action
=> 'freezer'}} %>

when I follow what (I think) you have suggested:

<%= submit_to_remote 'Freezer', 'freezer', {:url => { :action =>
'freezer' }, :name => image_tag("/images/icecube.gif")} %>

doesn;t pick up the image. But The hash key may be something other
than 'name' (I have tried, 'image,' and 'img' but I dont see how this
would map to the name parameter in link_to_remote) -Janna B
--~--~-~--~~~---~--~~
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] observe_field value in controller

2009-07-09 Thread JannaB

how do I access the value of the field referenced in observe_field
from within my controller for the action specified?

I have a select with id "channelnotes" on it, to which I have an
observe_field that correctly works in calling channels.notesboxchange.
In my controller, I am trying to pick up the value of the select from
puts params['channelnotes'] and puts params[:channelnotes] and getting
nil, even when the select has text selected in it.

I must be doing something stoopid. Below is my .html.erb, as well as
the html/js produced by it. Thanks, Janna B.

<% form_for :associates, :html => {:name => 'upsform',:id =>
'upsform'},:url=>{ :action =>"uplog_update_form", :controller
=>"channels"} do |f| %>

Notes: 
  
  Subrata
  Chakrabarty
  Tiger
  Software
  India


<%= observe_field "channelnotes", :url => {:controller
=> :channels, :action => 'notesboxchange'} %>




Notes: 
  
  Subrata
  Chakrabarty
  Tiger
  Software

  India



//


--~--~-~--~~~---~--~~
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: submit_to_remote with image

2009-07-09 Thread JannaB

Ok, but I cannot have a submit_to_remote with an image, right?
--~--~-~--~~~---~--~~
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] submit_to_remote with image

2009-07-09 Thread JannaB

Anyone have an idea how I can shoehorn (or workaround)  a
submit_to_remote to accept html options so that I might put an image
to it?
--~--~-~--~~~---~--~~
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] Modal dialog box

2009-07-09 Thread JannaB

How, typically, do you manage, say, what would be a modal-type dialog
box on a non-Rails application? How do you handle that type of thing
in Rails? (I don't want to fo off on some wild tangent in my code, but
want to keep things as rails-like as possible. I'm thinking there must
be a defacto standard for htis type of thing, but I am not finding it)
-Janna B
--~--~-~--~~~---~--~~
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: button_to_remote and control values

2009-07-09 Thread JannaB

Fred, you are SO the man. How do you KNOW all this stuff??? If I work
with this for 5 years I won't know what you know. -Janna B.

On Jul 9, 9:56 am, Frederick Cheung 
wrote:
> On Jul 9, 1:17 pm, JannaB  wrote:
>
> > I have a partial that has a button_to_remote on it wherein a method in
> > my controller is appropriately executed. In the same partial, but not
> > in any  I have a select box with the id of "notesboxselect."
>
> > Is there any way I can pass the text of what is in this select box, to
> > the method in my controller called by the button_to_remote? Thanks,
> > Janna B
>
> Sounds like the easiest option here would be the :submit  option of
> the various *_remote helpers
>
> Fred
>
>
>
> > 
> > Notes:  > onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress =
> > "return fnKeyPressHandler_A(this, event);"  onChange="fnChangeHandler_A
> > (this, event);">
> >    > OPTION>
> >   Subrata
> >   Chakrabarty
> >   Tiger
> >   Software
> >   India
> > 
> > 
>
> > <%=button_to_remote "Manual Up",
> >    :url => { :action => "manup" },
> >    :update => "insideuplog"
> > %>
--~--~-~--~~~---~--~~
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] button_to_remote and control values

2009-07-09 Thread JannaB

I have a partial that has a button_to_remote on it wherein a method in
my controller is appropriately executed. In the same partial, but not
in any  I have a select box with the id of "notesboxselect."

Is there any way I can pass the text of what is in this select box, to
the method in my controller called by the button_to_remote? Thanks,
Janna B


Notes: 
  
  Subrata
  Chakrabarty
  Tiger
  Software
  India




<%=button_to_remote "Manual Up",
   :url => { :action => "manup" },
   :update => "insideuplog"
%>
--~--~-~--~~~---~--~~
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: Button that doesn't submit

2009-07-08 Thread JannaB

Yes, I tried that:

<%= button_to "Manual Up", :action => "manup" %>

Then, in my controller I have it either rendering nothing or a
partial. But it renders a blank page even though the partial is
embedded deep within divs of another partial. So whether I tell it to
render nothing, or just the deeply-buried partial, it takes me to a
blank page! (I think it is because it is actually a submit. I can
confrim my controller method is being executed_ -Janna



On Jul 8, 2:44 pm, Philip Hallstrom  wrote:
> On Jul 8, 2009, at 11:40 AM, JannaB wrote:
>
>
>
> > Is there a way to put a button on a view that doesn;t do a "submit"
> > but executes a method in the controller? -Janna
>
> Look at the button_to methods... although by default they create a  
> form to your action and submit it you can control the method... not a  
> good idea to embed that within another form though.
--~--~-~--~~~---~--~~
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] Button that doesn't submit

2009-07-08 Thread JannaB

Is there a way to put a button on a view that doesn;t do a "submit"
but executes a method in the controller? -Janna
--~--~-~--~~~---~--~~
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 Trigger 'onclick' or 'onchange' on

2009-07-08 Thread JannaB

This is easily a dhtml issue, or one that can likely be performed in
rjs. (repopulating 'b') when someting occurs. Additionally, here is
working code I use to pick up when a dropdown's selection has changed:

<% form_for :channels, :html => {:name => 'channelsform'},:url=>
{ :action =>"newchannel", :controller =>"channels"} do |f| %>
<%= f.label "Channel" %>
<%= select("channel", "id", Channel.find(:all,  :order => 'channel
ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel,
p.id ]}, { :include_blank => true}, { :onchange =>
"document.channelsform.submit();"}) %>

<%end%>

It;s a little polluted with real-world dictates, but I dont want to
hack things out for trhis example and give you a broken example
inadvertently. The meat occurs in the :onchange where the form is
submitted in this case (when the user changes their selection).
Incidentally, this occurs in a partial, which then executes the
Channelscontroller.newchannel method. Perhaps you make a partial
holding dropdown 'b' and repopulate it in such a method? That should
work fine -Janna B

On Jul 8, 2:46 am, Rails List 
wrote:
> I have two dropdowns 'a' and 'b'.  when something is selected on 'a',
> its onchange event has an action and an update area which works fine.
>
> but when it comes to editing a record, i am able to list items in 'a'
> dropdown and select the current value but this leave 'b' dropdown empty.
>
> i would like to trigger an onchange or onclick event for 'a's selected
> value so that 'b' drop down is populated correctly.
>
> any ideas?
> --
> Posted viahttp://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: programmatically add a route

2009-07-08 Thread JannaB

Well, for example. I was going to have it write partials into /public/
blahblah/_mypartial!.erb
--~--~-~--~~~---~--~~
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] Editable Combobox

2009-07-08 Thread JannaB

I am in dire need of something like an editable combox - though, it
doesn;t have to subscribe to the combo box idiom - perhaps some of the
ajax-like features / dhtml can provide what I need. What do people in
the RoR world do when they need this kind of functionality? Thanks,
Janna B.
--~--~-~--~~~---~--~~
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: Executing js when a partial loads

2009-07-07 Thread JannaB

Thank you Naren. The solution proposed by Vitaly I just tried out and
it works! However, I have:

startClock("../../../../public/test/ggriptest/
getdata1.dat","../../../../public/test/ggriptest/getdata2.dat");

my app (this particular partial) is in

G:\InstantRails\rails_apps\ggripv2\app\views\channels

and the two .dat files (which contain JSON data) are at:

G:\InstantRails\rails_apps\ggripv2\public\test\ggriptest

Am I specifying this correctly in the parameters above? -Janna
--~--~-~--~~~---~--~~
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: Executing js when a partial loads

2009-07-07 Thread JannaB

Naren,

Ok, in my rjs I pass it:

page.call "startClock" "" ""

Still, nothing happend (but no error in firebug console now) -Janna
--~--~-~--~~~---~--~~
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: Executing js when a partial loads

2009-07-07 Thread JannaB

Nothing happens. Nothing at all. I see "rows" and "names" printed up,
but in my uplog.js, which contains the function startclock(..) which
has an alert in it, evidently never gets called. Worse yet, I get a
peculiar error in the Firefox Error Console when I click on the
link_to_remote link (the error is simply "Permission denied to call
method Location.toString). I am including all of the code below.

## Here is my partial that gets called:


names
<%= link_to_remote("StartClock",
:url =>{ :action => :clockstarter }) %>


rows


## Here is clockstarter.rjs:

page.call "startClock" "../../../../www/test/ggriptest/getdata1.dat"
"./getdata2.php'"

## This is in my layout, which the partial is loaded into:

<%= javascript_include_tag "uplog" %>

## Here is /public/javascripts/uplog.js


if (window.ActiveXObject && !window.XMLHttpRequest) {

  window.XMLHttpRequest = function() {

var msxmls = new Array(

  'Msxml2.XMLHTTP.6.0',

  'Msxml2.XMLHTTP.5.0',

  'Msxml2.XMLHTTP.4.0',

  'Msxml2.XMLHTTP.3.0',

  'Msxml2.XMLHTTP',

  'Microsoft.XMLHTTP');

for (var i = 0; i < msxmls.length; i++) {

  try {

return new ActiveXObject(msxmls[i]);

  } catch (e) {

  }

}

return null;

  };

}

// Gecko support

/* ;-) */

// Opera support

if (window.opera && !window.XMLHttpRequest) {

  window.XMLHttpRequest = function() {

this.readyState = 0; // 0=uninitialized,1=loading,2=loaded,
3=interactive,4=complete

this.status = 0; // HTTP status codes

this.statusText = '';

this._headers = [];

this._aborted = false;

this._async = true;

this._defaultCharset = 'ISO-8859-1';

this._getCharset = function() {

  var charset = _defaultCharset;

  var contentType = this.getResponseHeader('Content-
type').toUpperCase();

  val = contentType.indexOf('CHARSET=');

  if (val != -1) {

charset = contentType.substring(val);

  }

  val = charset.indexOf(';');

  if (val != -1) {

charset = charset.substring(0, val);

  }

  val = charset.indexOf(',');

  if (val != -1) {

charset = charset.substring(0, val);

  }

  return charset;

};

this.abort = function() {

  this._aborted = true;

};

this.getAllResponseHeaders = function() {

  return this.getAllResponseHeader('*');

};

this.getAllResponseHeader = function(header) {

  var ret = '';

  for (var i = 0; i < this._headers.length; i++) {

if (header == '*' || this._headers[i].h == header) {

  ret += this._headers[i].h + ': ' + this._headers[i].v +
'\n';

}

  }

  return ret;

};

this.getResponseHeader = function(header) {

  var ret = getAllResponseHeader(header);

  var i = ret.indexOf('\n');

  if (i != -1) {

ret = ret.substring(0, i);

  }

  return ret;

};

this.setRequestHeader = function(header, value) {

  this._headers[this._headers.length] = {h:header, v:value};

};

this.open = function(method, url, async, user, password) {

  this.method = method;

  this.url = url;

  this._async = true;

  this._aborted = false;

  this._headers = [];

  if (arguments.length >= 3) {

this._async = async;

  }

  if (arguments.length > 3) {

opera.postError('XMLHttpRequest.open() - user/password not
supported');

  }

  this.readyState = 1;

  if (this.onreadystatechange) {

this.onreadystatechange();

  }

};

this.send = function(data) {

  if (!navigator.javaEnabled()) {

alert("XMLHttpRequest.send() - Java must be installed and
enabled.");

return;

  }

  if (this._async) {

setTimeout(this._sendasync, 0, this, data);

// this is not really asynchronous and won't execute until the
current

// execution context ends

  } else {

this._sendsync(data);

  }

}

this._sendasync = function(req, data) {

  if (!req._aborted) {

req._sendsync(data);

  }

};

this._sendsync = function(data) {

  this.readyState = 2;

  if (this.onreadystatechange) {

this.onreadystatechange();

  }

  // open connection

  var url = new java.net.URL(new java.net.URL
(window.location.href), this.url);

  var conn = url.openConnection();

  for (var i = 0; i < this._headers.length; i++) {

conn.setRequestProperty(this._headers[i].h, this._headers
[i].v);

  }

  this._headers = [];

  if (this.method == 'POST') {

// POST data

conn.setDoOutput(true);

var wr = new java.io.OutputStreamWriter(conn.getOutputStream
(), this._getCharset());

wr.write(data);

wr.flush();

wr.close();

  }

  // read response headers

  // NOTE: the getHeaderField() methods always return nulls for
me :(

  var gotContentEncoding = fa

[Rails] like "observe_field"

2009-07-07 Thread JannaB

I don't see where this can be done in rails directly, but I am hoping
some creative mind can see how to use dvarious rails pieces to do it.

I need an ajax request like "observe_field" that triggers an action so
as to update something, but rather than a field in a form, I want to
observe a file containing json data on a server, such that when the
data changes, I read it, and perform an action with it to update
something.

Does anyone have any idea how I might accomplish this in RoR? Thanks,
Janna B
--~--~-~--~~~---~--~~
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] programmatically add a route

2009-07-07 Thread JannaB

Is there a way to programmartically add a route? I have an outside
process creating pages that I need to access, but I dont know their
names or locations until runtime. -Janna B
--~--~-~--~~~---~--~~
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: Executing js when a partial loads

2009-07-07 Thread JannaB

No, nor does this work in a partial.



--~--~-~--~~~---~--~~
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: Executing js when a partial loads

2009-07-06 Thread JannaB

Thanks but that doesn't work in a partial.
--~--~-~--~~~---~--~~
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] Executing js when a partial loads

2009-07-06 Thread JannaB

In my view I have a:

<%= render :partial => 'uplog' %>

and the partial is shown below. Note there is js in it which I thought
got executed on load (but, I have found out this does NOT happen when
a partial is loaded. How else can I execute the js below when the
partial gets loaded (someone said to call it explicitlybut how and
from where?) THanks, Janna B


names


rows


startClock('../../../../www/test/ggriptest/getdata1.dat','./
getdata2.php');

--~--~-~--~~~---~--~~
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: reassignement TCPSocket::new

2009-07-06 Thread JannaB

Then would the following be a problem in a controller  if concurrent
users use the app at the same time  ?

  socket = TCPSocket::new(@channel.serverip,
@channel.port)
  socket.send(s+"\n",0)
  socket.close

(multiple servers I am not concerned about -- one glassfish gem
instance roars with all the horsepower this particular app ever needs
-- but what WOULD happen if I ran this under multiple mongrel
instances? Can't the same port be shared by multiple instances?)
--~--~-~--~~~---~--~~
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] ajax update of a table

2009-07-05 Thread JannaB

I have a view that has a  element in it that I want to update
via ajax, so that the view is not refreshed. The number of rows I have
will be variable, expanding and contracting, and each row is an
element in an array of hashes for each cell in the row.

How do you typically do something like this in RoR? All the examples I
see are for the Scriptaculus kinds of things (autocompete, etc) but
what about something like this. How would you begin to tackle it?
Thanks, Janna B
--~--~-~--~~~---~--~~
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: reassignement TCPSocket::new

2009-07-05 Thread JannaB

Thanks Fred,

Yes, multiple users are not a problem as part of what is passed
through the socket is the reference to the user. I have numerous
channels that can be run, however, each with a different port
assignement, by various users. Thus, it would seem I want to create a
hash of

channels => sockets

but how can I make that be persistent?

-Janna B

On Jul 5, 11:11 am, Frederick Cheung 
wrote:
> On Jul 5, 8:59 am, JannaB  wrote:
>
>
>
> > Usually, however, the channel info will remain the same. So I am
> > wondering how I can make the socket persist from one POST/GET
> > operation to the other, unless the channel has changed.
>
> > And my second question is, if I someone does tell me how I can make it
> > persist, do I run the risk of some sort of memory leaks here with
> > this? I wonder because I have a solitary  TCPSocket object which would
> > then be reassigned -- does the un-assigned old reference that socket
> > contained go automatically out of scope and get garbage collected?
> > Thanks, Janna B
>
> If you reassign a variable then its old contents will eventually be
> garbage collected (assuming no other references to it).
> You are likely to run into other problems though here: have you
> thought about concurrent users using the app at the same time, or what
> happens when you have multiple mongrels / passenger instances ?
>
> Lastly it looks like @socket is an instance variable of your
> controller, since every request is served by a new controller instance
> @socket will always be nil.
>
> Fred
>
> > repeatedly in my controller, naturally,
--~--~-~--~~~---~--~~
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] reassignement TCPSocket::new

2009-07-05 Thread JannaB

in my model, I have:

attr_accessor :socket

in my controller I have

def toServer(s)
begin
  if(@socket == nil)
@socket = TCPSocket::new(@channel.serverip, @channel.port)
  end
 @socket.send(s,0)
rescue
  return
end
  end

I have a dropdown list in the view that lets the user select a
different channel, thus, the socket is created in the view based on
the ip and port of the selected channel.

Usually, however, the channel info will remain the same. So I am
wondering how I can make the socket persist from one POST/GET
operation to the other, unless the channel has changed.

And my second question is, if I someone does tell me how I can make it
persist, do I run the risk of some sort of memory leaks here with
this? I wonder because I have a solitary  TCPSocket object which would
then be reassigned -- does the un-assigned old reference that socket
contained go automatically out of scope and get garbage collected?
Thanks, Janna B
repeatedly in my controller, naturally,
--~--~-~--~~~---~--~~
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: php => rails (JSON)

2009-07-05 Thread JannaB

Magnificent! Thank you Conrad!

On Jul 5, 1:30 am, Conrad Taylor  wrote:
> On Sat, Jul 4, 2009 at 10:26 PM, Conrad Taylor  wrote:
> > On Sat, Jul 4, 2009 at 7:12 PM, JannaB  wrote:
>
> >> I have an application that creates a snippet of php in a server, fo
> >> packaging up data for JSON, using the php package "Pear." The snippet
> >> I create (with varying data, of course, as the application runs) is
> >> written in php, but I really want to keep things rails-centric. Is
> >> there a way to convert this to NOT use php, so that I am entirely Ruby
> >> on Rails? Thanks, Janna B
>
> >>  >> ini_set('include_path',ini_get('include_path').";C:\Program Files
> >> \Apache Group\Apache2\htdocs"."\pear");
> >> require('JSON.php');
>
> >> $records=array();
> >> $records[]=array('order'=>1, 'username'=>'joeyt');
> >> $json=new Services_JSON();
> >> echo($json->encode($records));
> >> ?>
>
> > Janna, the above PHP code simply converts a PHP array to JSON format.
> > Thus, you can do the equivalent in Ruby as follows:
>
> > require "json"
>
> > records = { order'=>1, 'username'=>'joeyt' }.to_json
>
> Correction:
>
> require "json"
>
> records = { 'order'=>1, 'username'=>'joeyt' }.to_json  # Missed the leading
> quote
>
> > Good luck,
>
> > -Conrad
--~--~-~--~~~---~--~~
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] php => rails (JSON)

2009-07-04 Thread JannaB

I have an application that creates a snippet of php in a server, for
packaging up data for JSON, using the php package "Pear." The snippet
I create (with varying data, of course, as the application runs) is
written in php, but I really want to keep things rails-centric. Is
there a way to convert this to NOT use php, so that I am entirely Ruby
on Rails? Thanks, Janna B

1, 'username'=>'joeyt');
$json=new Services_JSON();
echo($json->encode($records));
?>

--~--~-~--~~~---~--~~
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] Msdd update

2009-07-04 Thread JannaB

I must be missing something. I have a list of values returned (id's to
my 'associates'  table) and I want to update all of those in the list.
Presently, I iterate through the list, updating each one (see below).

Isn;t there a way I can do this all in one fell swoopy in RoR, without
having to iterate through the list? -Janna B.

params[:form__list1].each do |id|
  associate = Associate.find(id)
  associate.update_attributes({:channel_id =>
@channel.id, :joined_channel_datetime => DateTime.now})
end
--~--~-~--~~~---~--~~
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] Drag and Drop with Scriptaculous

2009-07-03 Thread JannaB

I have two side by side lists on a page, form__list1 and form__list2.
I want to drag ffrom list 1 to list 2. I am terribly confused on what
I must set up to make this drag and drop with Scritpaculous occur (and
where --- do I put things in my views, shown below, or the
helpers...or the controller). I know how to get the values from
form__list2 in my controller.I just need to know what to put in
(and where) to make the DnD via scriptaculus occur here. Thanks,
Janna, view below:


<% form__list1 = [] %>
<% form__list1selected = [] %>
<% options_for_select_hash = [] %>
<% options_for_select_hash = Associate.find(:all,  :order =>
'username ASC',  :conditions => ["deleted=0 and (branch like ? or ?
like branch)", @channel.defbranchcode,
@channel.defbranchcode]).collect {|p| [ p.username, p.id ]} %>
<%= select_tag('form__list1[]', options_for_select
(options_for_select_hash, form__list1selected
[options_for_select_hash.length]), html_options = {"size" => 15,
"multiple" => true, :style => "width:200px"}) %>
  
   
<% form__list2 = [] %>
<% form__list2selected = [] %>
<%= select_tag('form__list2[]', options_for_select([],
form__list2selected[options_for_select_hash.length+Associate.find
(:all, :conditions => ["deleted=0"]).length]), html_options = {"size"
=> 15, "multiple" => true, :style => "width:200px" }) %>
   
--~--~-~--~~~---~--~~
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] wrong number of arguments (0 for 1) in []

2009-07-02 Thread JannaB

I am creating a multiple-selection list box with :

 <% form__list1 = [] %>
<%= select_tag, options_for_select(["A","B","C","D"], selected ="A"),
html_options = {"size" => 5, "multiple" => true}) %>

I get
wrong number of arguments (0 for 1)
alluding to form__list1[] . How else should I specify this to not have
this error? -Janna B

--~--~-~--~~~---~--~~
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: selected in select

2009-07-02 Thread JannaB

Why would my variable I have in my controller as @channel, set as:
 def newchannel
@channel = Channel.find(params[:channel][:id])
render :action => 'display'
 end

Which occurs when the select box changes, be set to nil in another
method in my controller? It acts as a local variable to the function
newchannel -- but I want it to be available throughout my controller.
How can I achieve this? If I specify it as attr_accessor :channel in
my model, then the select box does not populate.
-Janna B.

On Jul 2, 11:20 am, Onur Gungor 
wrote:
> Janna Brossard wrote:
> > I have a partial in my view which has a select box:
>
> > <% form_for :channels, :html => {:name => 'channelsform'},:url=>
> > { :action =>"newchannel", :controller =>"channels"} do |f| %>
>
> > <%= f.select(:id , Channel.find(:all,  :order => 'channel
> > ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel,
> > p.id ]}, {:include_blank => true}, { :onchange =>
> > "document.channelsform.submit();"}) %>
>
> > In  my ChannelsController I pick up the value from this select box
> > correctly as: @channel = Channel.find(params[:channels][:id])
>
> > However, when the partial rerenders, it doesn;t show the selected
> > value. How can I make it show the selected value, given the syntax for
> > the form.select I have used?
>
> > Thanks, Janna B
>
> What I read from the documentation: select
> (ActionView::Helpers::FormOptionsHelper)
>
> "The option currently held by the object will be selected, provided that
> the object is available."
>
> Maybe you must use, while you have populated the object @channel in the
> controller rendering that view.
>
> <%= f.select("channel", "id" , Channel.find(:all,  :order => 'channel
> ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel,
> p.id ]}, {:include_blank => true}, { :onchange =>
> "document.channelsform.submit();"}) %>
>
> I am not sure but you may give it a ride.
> --
> Posted viahttp://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: selected in select

2009-07-02 Thread JannaB

My apologies to you -- I am frustrated. Yes, it works when I do as you
(guessed, heh heh) and take off the f so I have:

select("channel", "id"...

and in my controller, I specify now:
@channel = Channel.find(params[:channel][:id])

Thank you Onur. -Janna

On Jul 2, 11:41 am, Onur Gungor 
wrote:
> Janna Brossard wrote:
> > wrong # or arguments.
>
> > On Jul 2, 11:20 am, Onur Gungor 
>
> hmm.
>
> I can't try right now but did you try the method without the "f."? I
> mean call the "select" method not the method of the class which the "f"
> object belongs.
> --
> Posted viahttp://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: selected in select

2009-07-02 Thread JannaB

"Wrong # of arguments." Why answer a post if you don;t know the
answer? It deters those who DO know from answering. Please don;t just
speculate. By the time someone has posted, they have speculated as far
as they can go and are seeking direction on where to find the real
answer.

On Jul 2, 11:20 am, Onur Gungor 
wrote:
> Janna Brossard wrote:
> > I have a partial in my view which has a select box:
>
> > <% form_for :channels, :html => {:name => 'channelsform'},:url=>
> > { :action =>"newchannel", :controller =>"channels"} do |f| %>
>
> > <%= f.select(:id , Channel.find(:all,  :order => 'channel
> > ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel,
> > p.id ]}, {:include_blank => true}, { :onchange =>
> > "document.channelsform.submit();"}) %>
>
> > In  my ChannelsController I pick up the value from this select box
> > correctly as: @channel = Channel.find(params[:channels][:id])
>
> > However, when the partial rerenders, it doesn;t show the selected
> > value. How can I make it show the selected value, given the syntax for
> > the form.select I have used?
>
> > Thanks, Janna B
>
> What I read from the documentation: select
> (ActionView::Helpers::FormOptionsHelper)
>
> "The option currently held by the object will be selected, provided that
> the object is available."
>
> Maybe you must use, while you have populated the object @channel in the
> controller rendering that view.
>
> <%= f.select("channel", "id" , Channel.find(:all,  :order => 'channel
> ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel,
> p.id ]}, {:include_blank => true}, { :onchange =>
> "document.channelsform.submit();"}) %>
>
> I am not sure but you may give it a ride.
> --
> Posted viahttp://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: selected in select

2009-07-02 Thread JannaB

wrong # or arguments.

On Jul 2, 11:20 am, Onur Gungor 
wrote:
> Janna Brossard wrote:
> > I have a partial in my view which has a select box:
>
> > <% form_for :channels, :html => {:name => 'channelsform'},:url=>
> > { :action =>"newchannel", :controller =>"channels"} do |f| %>
>
> > <%= f.select(:id , Channel.find(:all,  :order => 'channel
> > ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel,
> > p.id ]}, {:include_blank => true}, { :onchange =>
> > "document.channelsform.submit();"}) %>
>
> > In  my ChannelsController I pick up the value from this select box
> > correctly as: @channel = Channel.find(params[:channels][:id])
>
> > However, when the partial rerenders, it doesn;t show the selected
> > value. How can I make it show the selected value, given the syntax for
> > the form.select I have used?
>
> > Thanks, Janna B
>
> What I read from the documentation: select
> (ActionView::Helpers::FormOptionsHelper)
>
> "The option currently held by the object will be selected, provided that
> the object is available."
>
> Maybe you must use, while you have populated the object @channel in the
> controller rendering that view.
>
> <%= f.select("channel", "id" , Channel.find(:all,  :order => 'channel
> ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel,
> p.id ]}, {:include_blank => true}, { :onchange =>
> "document.channelsform.submit();"}) %>
>
> I am not sure but you may give it a ride.
> --
> Posted viahttp://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] selected in select

2009-07-02 Thread JannaB

I have a partial in my view which has a select box:

<% form_for :channels, :html => {:name => 'channelsform'},:url=>
{ :action =>"newchannel", :controller =>"channels"} do |f| %>

<%= f.select(:id , Channel.find(:all,  :order => 'channel
ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel,
p.id ]}, {:include_blank => true}, { :onchange =>
"document.channelsform.submit();"}) %>

In  my ChannelsController I pick up the value from this select box
correctly as: @channel = Channel.find(params[:channels][:id])

However, when the partial rerenders, it doesn;t show the selected
value. How can I make it show the selected value, given the syntax for
the form.select I have used?

Thanks, Janna B
--~--~-~--~~~---~--~~
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: Scriptaculous -- How do I access from Rails?

2009-06-27 Thread JannaB

Thank all of you gentleman very much. As I read your suggestions, it
occurs to me that I have perhaps not modelled what I need to do
smartly -- and that is making this further complicated. I have a
number of models which I need t ocombine into a view. For instance, I
have an players model, which I need to make a list of (batting order)
(which is what I want to be able to drag into from the team, and out
of), this list to occur on the left side of the view, and in the
center, I will put rows containing informations (my info 'model'
class)  that have occured throughout the game, with various link_to's
in he informations.

So I have all these data models that I must put into one composited
view. And I am really lost now how one might do this in rails. I do
not have a model for this compositied view (though, I could make one
-- consistening of two arrays) but then how would I save all this in
the db (right now I have info and player model) and the fact that the
data for this composited view doesn;t need to be persisted. This
really is at the core of my problems here I suppose - and I have no
idea how to set this up. -Janna B

On Jun 27, 7:16 am, Frederick Cheung 
wrote:
> On Jun 27, 2:49 am, JannaB  wrote:
>
>
>
> > Exactly -- or so I am learning. Look, the scriptaculous stuff. for
> > instance, is laden with examples. Trying to do the same thing in
> > rails, though purported to be "easier," and more expeditious, is
> > actually a complete pain -- the absence of exampls & documentation
> > really holds you back and squanders my time. Heneforth, as a matter of
> > design philosophy, I think we are FAR better tos stick to html/
> > javascript/css and only use rails to tie back into on the server side.
>
> > THAT SAIDI am wondering where I tie rails into the source on:
>
> >http://www.gregphoto.net/sortable/advanced/
>
> > and if I cannot tie into it somehow, easily, might as well find a
> > different mechanism than RoR -- to my way of thinking and my limited
> > experience with RoR, if it cannot at least do that easily, it's
> > pointless to pursue as a viable platform for web development. -Janna
> > B.
>
> At the end of the day, Rails is mostly a server side thing. In any
> sensible world your choice of front end tools (javascript libraries
> and so on) doesn't impact on the backend (be it rails, a php framework
> etc.).
>
> Making a list like that with items from your app doesn't require big
> chunks of integration. create the html for the list items as you would
> for a completely static display (just ensuring that each element has a
> DOM id). Then you need to run the javascript that will setup the
> scriptaculous side of things. If you want to do exactly what that
> example website does then you might have to generate some javascript
> yourself (rails can make the script tags for you but then you need to
> fill in the blanks), or if what you want is what the scriptaculous
> helpers do then something like
>
> <%= sortable_element 'message_list',
>     :url => sort_things_path,
>     :complete=> visual_effect(:highlight, 'message_list'),
>     :tag => 'div'%>
>
> will do the trick.
>
> Fred
>
> > On Jun 26, 4:29 pm, Conrad Taylor  wrote:
>
> > > Janna, this was mentioned at Railsconf 2009 during the Rails Core
> > > Panel talk.  It was actually the second question from the start of the
> > > talk.  In short, one should understand the underlying technologies
> > > instead of trying to always abstracting it away.
>
> > > -Conrad
>
> > > On Fri, Jun 26, 2009 at 11:04 AM, JannaB  
> > > wrote:
>
> > > > And I further agree with you -- I think we all need to bite the bullet
> > > > and become js experts rather than depending on Rails to do it for us.
> > > > The problem is, if I look at all this JS that I am seeing in this
> > > > example, I am trying to discern where in my rails app I pick up these
> > > > values? -Janna B.
>
> > > > On Jun 26, 2:02 pm, JannaB  wrote:
> > > > > Thanks Fred,
> > > > > Yes, this is immensely frustrating -- I've lost 3 days working on
> > > > > this, and looking at examples that don;t cut it -- there is a vacuum
> > > > > of documentation really, and it seems to be a very RoR thing "Yes,
> > > > > this is fast and easy to do in RoR with this library/plugin/gem," but
> > > > > when you go to actually do it, you are left with total trial and
> > > > > error.
>
> > > > > No wonder the dork frameworks like Java St

[Rails] Re: Scriptaculous -- How do I access from Rails?

2009-06-26 Thread JannaB

Exactly -- or so I am learning. Look, the scriptaculous stuff. for
instance, is laden with examples. Trying to do the same thing in
rails, though purported to be "easier," and more expeditious, is
actually a complete pain -- the absence of exampls & documentation
really holds you back and squanders my time. Heneforth, as a matter of
design philosophy, I think we are FAR better tos stick to html/
javascript/css and only use rails to tie back into on the server side.

THAT SAIDI am wondering where I tie rails into the source on:

http://www.gregphoto.net/sortable/advanced/

and if I cannot tie into it somehow, easily, might as well find a
different mechanism than RoR -- to my way of thinking and my limited
experience with RoR, if it cannot at least do that easily, it's
pointless to pursue as a viable platform for web development. -Janna
B.

On Jun 26, 4:29 pm, Conrad Taylor  wrote:
> Janna, this was mentioned at Railsconf 2009 during the Rails Core
> Panel talk.  It was actually the second question from the start of the
> talk.  In short, one should understand the underlying technologies
> instead of trying to always abstracting it away.
>
> -Conrad
>
> On Fri, Jun 26, 2009 at 11:04 AM, JannaB  wrote:
>
> > And I further agree with you -- I think we all need to bite the bullet
> > and become js experts rather than depending on Rails to do it for us.
> > The problem is, if I look at all this JS that I am seeing in this
> > example, I am trying to discern where in my rails app I pick up these
> > values? -Janna B.
>
> > On Jun 26, 2:02 pm, JannaB  wrote:
> > > Thanks Fred,
> > > Yes, this is immensely frustrating -- I've lost 3 days working on
> > > this, and looking at examples that don;t cut it -- there is a vacuum
> > > of documentation really, and it seems to be a very RoR thing "Yes,
> > > this is fast and easy to do in RoR with this library/plugin/gem," but
> > > when you go to actually do it, you are left with total trial and
> > > error.
>
> > > No wonder the dork frameworks like Java Struts are so much more
> > > prevelant. In truth, those frameworks may just be faster and easier to
> > > use -- I've been trying to accomplish things here that frankly don;t
> > > pay off in terms of the time curve. No one seems to know how to use
> > > the Scritpatuclous library's aside from mickey mouse effects.
>
> > > -Janna B.
>
> > > On Jun 25, 11:43 am, Frederick Cheung 
> > > wrote:
>
> > > > On Jun 25, 3:32 pm, JannaB  wrote:
>
> > > > > If I look at a page with a Scriptaculous example like:
> > > > anks Fred
> > > > >http://www.gregphoto.net/sortable/advanced/
>
> > > > > And I can view the html/js source of the page -- my question becomes,
> > > > > how do I implement this, or wire this into, my rails app? -Janna B
>
> > > > You need to , one way or another, generate the javascript that sets up
> > > > the scriptaculous stuff (ie create instances of Sortable for
> > > > appropriate dom elements and so on). There are helpers
> > > > (draggable_element and so ) that sort of do this for you but
> > > > personally I feel that most of that stuff is a bit of a crutch and
> > > > that you'd be better off biting the bullet and learning enough
> > > > javascript/scriptaculous that you can just write it on your own.
>
> > > > Fred
--~--~-~--~~~---~--~~
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: Scriptaculous -- How do I access from Rails?

2009-06-26 Thread JannaB

And I further agree with you -- I think we all need to bite the bullet
and become js experts rather than depending on Rails to do it for us.
The problem is, if I look at all this JS that I am seeing in this
example, I am trying to discern where in my rails app I pick up these
values? -Janna B.

On Jun 26, 2:02 pm, JannaB  wrote:
> Thanks Fred,
> Yes, this is immensely frustrating -- I've lost 3 days working on
> this, and looking at examples that don;t cut it -- there is a vacuum
> of documentation really, and it seems to be a very RoR thing "Yes,
> this is fast and easy to do in RoR with this library/plugin/gem," but
> when you go to actually do it, you are left with total trial and
> error.
>
> No wonder the dork frameworks like Java Struts are so much more
> prevelant. In truth, those frameworks may just be faster and easier to
> use -- I've been trying to accomplish things here that frankly don;t
> pay off in terms of the time curve. No one seems to know how to use
> the Scritpatuclous library's aside from mickey mouse effects.
>
> -Janna B.
>
> On Jun 25, 11:43 am, Frederick Cheung 
> wrote:
>
> > On Jun 25, 3:32 pm, JannaB  wrote:
>
> > > If I look at a page with a Scriptaculous example like:
> > anks Fred
> > >http://www.gregphoto.net/sortable/advanced/
>
> > > And I can view the html/js source of the page -- my question becomes,
> > > how do I implement this, or wire this into, my rails app? -Janna B
>
> > You need to , one way or another, generate the javascript that sets up
> > the scriptaculous stuff (ie create instances of Sortable for
> > appropriate dom elements and so on). There are helpers
> > (draggable_element and so ) that sort of do this for you but
> > personally I feel that most of that stuff is a bit of a crutch and
> > that you'd be better off biting the bullet and learning enough
> > javascript/scriptaculous that you can just write it on your own.
>
> > Fred
--~--~-~--~~~---~--~~
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: Scriptaculous -- How do I access from Rails?

2009-06-26 Thread JannaB

Thanks Fred,
Yes, this is immensely frustrating -- I've lost 3 days working on
this, and looking at examples that don;t cut it -- there is a vacuum
of documentation really, and it seems to be a very RoR thing "Yes,
this is fast and easy to do in RoR with this library/plugin/gem," but
when you go to actually do it, you are left with total trial and
error.

No wonder the dork frameworks like Java Struts are so much more
prevelant. In truth, those frameworks may just be faster and easier to
use -- I've been trying to accomplish things here that frankly don;t
pay off in terms of the time curve. No one seems to know how to use
the Scritpatuclous library's aside from mickey mouse effects.

-Janna B.

On Jun 25, 11:43 am, Frederick Cheung 
wrote:
> On Jun 25, 3:32 pm, JannaB  wrote:
>
> > If I look at a page with a Scriptaculous example like:
> anks Fred
> >http://www.gregphoto.net/sortable/advanced/
>
> > And I can view the html/js source of the page -- my question becomes,
> > how do I implement this, or wire this into, my rails app? -Janna B
>
> You need to , one way or another, generate the javascript that sets up
> the scriptaculous stuff (ie create instances of Sortable for
> appropriate dom elements and so on). There are helpers
> (draggable_element and so ) that sort of do this for you but
> personally I feel that most of that stuff is a bit of a crutch and
> that you'd be better off biting the bullet and learning enough
> javascript/scriptaculous that you can just write it on your own.
>
> Fred
--~--~-~--~~~---~--~~
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] Scriptaculous -- How do I access from Rails?

2009-06-25 Thread JannaB

If I look at a page with a Scriptaculous example like:

http://www.gregphoto.net/sortable/advanced/

And I can view the html/js source of the page -- my question becomes,
how do I implement this, or wire this into, my rails app? -Janna B
--~--~-~--~~~---~--~~
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 do you do this in Rails?

2009-06-24 Thread JannaB

Ahh, right...that's it. God, I just couldn't get that -- ok, off to do
it the right way that you showed me! -Janna.

On Jun 24, 2:04 pm, Gavin  wrote:
> Okay - I'm assuming the action your form posts to is newchannel and
> you want to access the input from the form in that method?
> In which case:
>
> @channel_id_you_want = params[:ups][:channel_id]
>
> That should work?
>
> Gavin
>
> http://handyrailstips.com
>
> On Jun 24, 6:59 pm, JannaB  wrote:
>
> > Gavin,
>
> > Sorry to beat the dead horse, but I still need to know how to access
> > the channel_id given the way I initially posted the code. Can you show
> > me that? -Janna
>
> > On Jun 24, 1:42 pm, Gavin  wrote:
>
> > > damn - sorry that should be:
> > > <%= f.collection_select :channel_id, @channels, :id, :channel, :prompt
> > > => true %>
>
> > > missed out the text_method param
>
> > > Gavin
>
> > >http://handyrailsitps.com
>
> > > On Jun 24, 6:40 pm, Gavin  wrote:
>
> > > > Try using <%- end -%> instead of <% end %> at the of the form. That
> > > > should remove the line feeds and white space.
>
> > > > A lot of rails coders wouldn't use the named scope here.
> > > > I always try to keep as much of this sort of logic in the model but
> > > > you could also simply use 'find' in the controller:
>
> > > > @channels = Channel.all( :conditions => { :deleted => false }, :order
> > > > => 'channel ASC' ).collect { |p| p.name, p.id }
>
> > > > also check out 
> > > > collection_select:http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelp...
>
> > > > I think this might be more appropriate for you in this instance:
>
> > > > <%= f.collection_select :channel_id, @channels, :id, :prompt => true
> > > > %>
>
> > > > Hope that helps?
>
> > > > Gavin
>
> > > >http://handyrailstips.com
>
> > > > On Jun 24, 5:58 pm, JannaB  wrote:
>
> > > > > Gavin,
>
> > > > > Thank you. But suppose I didn't use a named scope -- in that case, how
> > > > > then could I refer to it in my controller? (though I will follow your
> > > > > advice and use the named scope, I need to know the other way also).
>
> > > > > Also, between:
>
> > > > >   <%= f.submit "Change" , :class=>'button' %>
> > > > > <% end %>
> > > > >         <%= links_for_uplog %>
>
> > > > > it seems a line feed occurs..the  <%= links_for_uplog %>  is not
> > > > > immediately to the right as I would like it to be (in <%=
> > > > > links_for_uplog %>,
>
> > > > > the rendered html appears as (copying from firebug):
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Channel
> > > > > 
> > > > > 
> > > > > ggriptest
> > > > > 
> > > > > 
> > > > > Audit
> > > > > Hotwire
> > > > > Uplog
> > > > > 
>
> > > > > It appears that after either  or  there is some kind
> > > > > of a line feed in the display.
>
> > > > > Can you please answer Me those two questions Gavin? Thank You, Janna
>
> > > > > On Jun 24, 12:47 pm, Gavin  wrote:
>
> > > > > > Hi Janna,
>
> > > > > > First, you shouldn't be calling Channel.find(:all,  :order => 
> > > > > > 'channel
> > > > > > ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel, p.id 
> > > > > > ]}
>
> > > > > > I'd add a named scope to the Channel model like so:
>
> > > > > >   named_scope :not_deleted, :conditions => {:deleted =>
> > > > > > false }, :order => 'channel ASC'
>
> > > > > > And then in the controller:
> > > > > > @channels = Channel.not_deleted
>
> > > > > > Then in your view:
> > > > > > <%= f.select :channel_id, @channels %>
>
> > > > > > The standard here would be to create the new Ups in a method called
> > > > > > create. By using form_for on a new record rails will automatically
> > > > &

[Rails] Re: How do you do this in Rails?

2009-06-24 Thread JannaB

Gavin,

Sorry to beat the dead horse, but I still need to know how to access
the channel_id given the way I initially posted the code. Can you show
me that? -Janna

On Jun 24, 1:42 pm, Gavin  wrote:
> damn - sorry that should be:
> <%= f.collection_select :channel_id, @channels, :id, :channel, :prompt
> => true %>
>
> missed out the text_method param
>
> Gavin
>
> http://handyrailsitps.com
>
> On Jun 24, 6:40 pm, Gavin  wrote:
>
> > Try using <%- end -%> instead of <% end %> at the of the form. That
> > should remove the line feeds and white space.
>
> > A lot of rails coders wouldn't use the named scope here.
> > I always try to keep as much of this sort of logic in the model but
> > you could also simply use 'find' in the controller:
>
> > @channels = Channel.all( :conditions => { :deleted => false }, :order
> > => 'channel ASC' ).collect { |p| p.name, p.id }
>
> > also check out 
> > collection_select:http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelp...
>
> > I think this might be more appropriate for you in this instance:
>
> > <%= f.collection_select :channel_id, @channels, :id, :prompt => true
> > %>
>
> > Hope that helps?
>
> > Gavin
>
> >http://handyrailstips.com
>
> > On Jun 24, 5:58 pm, JannaB  wrote:
>
> > > Gavin,
>
> > > Thank you. But suppose I didn't use a named scope -- in that case, how
> > > then could I refer to it in my controller? (though I will follow your
> > > advice and use the named scope, I need to know the other way also).
>
> > > Also, between:
>
> > >   <%= f.submit "Change" , :class=>'button' %>
> > > <% end %>
> > >         <%= links_for_uplog %>
>
> > > it seems a line feed occurs..the  <%= links_for_uplog %>  is not
> > > immediately to the right as I would like it to be (in <%=
> > > links_for_uplog %>,
>
> > > the rendered html appears as (copying from firebug):
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Channel
> > > 
> > > 
> > > ggriptest
> > > 
> > > 
> > > Audit
> > > Hotwire
> > > Uplog
> > > 
>
> > > It appears that after either  or  there is some kind
> > > of a line feed in the display.
>
> > > Can you please answer Me those two questions Gavin? Thank You, Janna
>
> > > On Jun 24, 12:47 pm, Gavin  wrote:
>
> > > > Hi Janna,
>
> > > > First, you shouldn't be calling Channel.find(:all,  :order => 'channel
> > > > ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel, p.id ]}
>
> > > > I'd add a named scope to the Channel model like so:
>
> > > >   named_scope :not_deleted, :conditions => {:deleted =>
> > > > false }, :order => 'channel ASC'
>
> > > > And then in the controller:
> > > > @channels = Channel.not_deleted
>
> > > > Then in your view:
> > > > <%= f.select :channel_id, @channels %>
>
> > > > The standard here would be to create the new Ups in a method called
> > > > create. By using form_for on a new record rails will automatically
> > > > know to post to an action called create so, unless you have a good
> > > > reason not to, I'd recommend calling your controller method "create"
> > > > and letting Rails behave the way it wants to.
>
> > > > which 'line feed' do you want to remove?
>
> > > > Gavin
>
> > > >http://handyrailstips.com
>
> > > > On Jun 24, 4:46 pm, JannaB  wrote:
>
> > > > > I have a model ("Ups")  and a corresponding controller
> > > > > ("UpsController"). The Ups model has a link to my "channels" toble
> > > > > through channel_id
>
> > > > > Everything I am going to do in the given views for Ups have to do with
> > > > > using those ups from a selected channel. Thus, I am putting a partial
> > > > > at the top of the views, with a select box to choose the channels:
>
> > > > > 
> > > > > <% form_for :ups, :html => {:name => 'channelsform'},:url=>{ :action
> > > > > =>"newchannel", :controller =>"ups"} do |f| %>
> > > > >     <%= f.label :c

[Rails] Re: How do you do this in Rails?

2009-06-24 Thread JannaB

Gavin,

Thank you. But suppose I didn't use a named scope -- in that case, how
then could I refer to it in my controller? (though I will follow your
advice and use the named scope, I need to know the other way also).

Also, between:

  <%= f.submit "Change" , :class=>'button' %>
<% end %>
<%= links_for_uplog %>

it seems a line feed occurs..the  <%= links_for_uplog %>  is not
immediately to the right as I would like it to be (in <%=
links_for_uplog %>,

the rendered html appears as (copying from firebug):





Channel


ggriptest


Audit
Hotwire
Uplog



It appears that after either  or  there is some kind
of a line feed in the display.

Can you please answer Me those two questions Gavin? Thank You, Janna

On Jun 24, 12:47 pm, Gavin  wrote:
> Hi Janna,
>
> First, you shouldn't be calling Channel.find(:all,  :order => 'channel
> ASC',  :conditions => ['deleted=0']).collect {|p| [ p.channel, p.id ]}
>
> I'd add a named scope to the Channel model like so:
>
>   named_scope :not_deleted, :conditions => {:deleted =>
> false }, :order => 'channel ASC'
>
> And then in the controller:
> @channels = Channel.not_deleted
>
> Then in your view:
> <%= f.select :channel_id, @channels %>
>
> The standard here would be to create the new Ups in a method called
> create. By using form_for on a new record rails will automatically
> know to post to an action called create so, unless you have a good
> reason not to, I'd recommend calling your controller method "create"
> and letting Rails behave the way it wants to.
>
> which 'line feed' do you want to remove?
>
> Gavin
>
> http://handyrailstips.com
>
> On Jun 24, 4:46 pm, JannaB  wrote:
>
> > I have a model ("Ups")  and a corresponding controller
> > ("UpsController"). The Ups model has a link to my "channels" toble
> > through channel_id
>
> > Everything I am going to do in the given views for Ups have to do with
> > using those ups from a selected channel. Thus, I am putting a partial
> > at the top of the views, with a select box to choose the channels:
>
> > 
> > <% form_for :ups, :html => {:name => 'channelsform'},:url=>{ :action
> > =>"newchannel", :controller =>"ups"} do |f| %>
> >     <%= f.label :channel_id %>
> >         <%= select("channel", "channel_id", Channel.find(:all,  :order =>
> > 'channel ASC',  :conditions => ['deleted=0']).collect {|p|
> > [ p.channel, p.id ]}, {:include_blank => true}) %>
> >         <%= f.submit "Change" , :class=>'button' %>
> > <% end %>
> >         <%= links_for_uplog %>
> > 
>
> > My question is, within my UpsController.newchannel(), how do I access
> > the calue of the channel_id that has been selected in the form
> > submission?
>
> > Incidentally, if you look at the erb code I put above, there is a line
> > feed that gets inserted after the submit button, before the next
> > section " links_for_uplog " within the div. How can I not have that?
>
> > Thanks, Janna
--~--~-~--~~~---~--~~
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 do you do this in Rails?

2009-06-24 Thread JannaB

I have a model ("Ups")  and a corresponding controller
("UpsController"). The Ups model has a link to my "channels" toble
through channel_id

Everything I am going to do in the given views for Ups have to do with
using those ups from a selected channel. Thus, I am putting a partial
at the top of the views, with a select box to choose the channels:



<% form_for :ups, :html => {:name => 'channelsform'},:url=>{ :action
=>"newchannel", :controller =>"ups"} do |f| %>
<%= f.label :channel_id %>
<%= select("channel", "channel_id", Channel.find(:all,  :order =>
'channel ASC',  :conditions => ['deleted=0']).collect {|p|
[ p.channel, p.id ]}, {:include_blank => true}) %>
<%= f.submit "Change" , :class=>'button' %>
<% end %>
<%= links_for_uplog %>


My question is, within my UpsController.newchannel(), how do I access
the calue of the channel_id that has been selected in the form
submission?

Incidentally, if you look at the erb code I put above, there is a line
feed that gets inserted after the submit button, before the next
section " links_for_uplog " within the div. How can I not have that?

Thanks, Janna
--~--~-~--~~~---~--~~
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] Drag and Drop - one list to the other

2009-06-24 Thread JannaB

Is anyone aware of an example of dragging text items from one list box
to another? For some reason, the examples I find down;t show this, and
I am realy struggling with this (what should be a simple) thing!
Thanks, Janna
--~--~-~--~~~---~--~~
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] Strings from a Sockets Client

2009-06-16 Thread JannaB

It seems Ruby Strings are a mess if you are trying to send them to a
server listening on a given socket (that is not a ruby server. Say it
is a Java server). Has anyone found a workaround for this?

I have a ruby client that must talk to a (running) Java process on the
server -- I cannot use JRuby on this one. Therefore, I am trying to
communicate to it via a tcp sockets connection. I think what I need to
do is likely convert the string to an array of integers representing
the string (but even integers are objects in Ruby!). How can I
communicate to a Java Sockets Server in Ruby? Thanks, Janna B
--~--~-~--~~~---~--~~
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: Preload form fields with vaiables

2009-06-13 Thread JannaB



Yes yeshere it is, I have it working and here is the syntax, in
case someone searches and arrives here in the future. Thansk
Frederick!

<%= text_field 'email', 'recipient', {:value => getAddy(params
[:id]), :readonly => 'true'} %>

# Janna B

On Jun 13, 10:15 am, Frederick Cheung 
wrote:
> On 13 Jun 2009, at 13:36, JannaB  wrote:
>
>
>
> > I have the following for which uses javascript to preload a couple of
> > fields but it doesn't work on a Blackberry (even IF javascript is
> > enabled there). Is there a non-javascript way of preloading the fields
> > I have in my form below? Thanks, Janna
>
> If your @email object has attributes called subject and so on,  
> text_field will take the value from there, if not the helpers take an  
> option (:value) or an argument to set what the initial value should be
>
> Fred
>
>
>
> > Send Email
> > <% form_remote_tag :update => 'Body', :url => {:controller =>
> > 'emailer', :action => 'sendmail'}, :html => {:name => 'form'+(params
> > [:id]).to_s}  do %>
> > Subject:
> > <%= text_field 'email', 'subject' %>
> > Recipient:
> > <%= text_field 'email', 'recipient',  :readonly => 'true' %>
> > Message
> > <%= text_area 'email', 'message' %>
> > <%= submit_tag "Send"%>
> > <% end %>
> > 
> >    var r = '<%= getAddy(params['id']) %>';
> >    document.<%= 'form'+(params['id']).to_s %>.email_recipient.value =
> > r;
> >    var  s = '<%= getSub(params['id']) %>';
> >    document.<%= 'form'+(params['id']).to_s %>.email_subject.value =
> > s;
> >  
--~--~-~--~~~---~--~~
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] Preload form fields with vaiables

2009-06-13 Thread JannaB

I have the following for which uses javascript to preload a couple of
fields but it doesn't work on a Blackberry (even IF javascript is
enabled there). Is there a non-javascript way of preloading the fields
I have in my form below? Thanks, Janna

Send Email
<% form_remote_tag :update => 'Body', :url => {:controller =>
'emailer', :action => 'sendmail'}, :html => {:name => 'form'+(params
[:id]).to_s}  do %>
Subject:
<%= text_field 'email', 'subject' %>
Recipient:
<%= text_field 'email', 'recipient',  :readonly => 'true' %>
Message
<%= text_area 'email', 'message' %>
<%= submit_tag "Send"%>
<% end %>
 
var r = '<%= getAddy(params['id']) %>';
document.<%= 'form'+(params['id']).to_s %>.email_recipient.value =
r;
var  s = '<%= getSub(params['id']) %>';
document.<%= 'form'+(params['id']).to_s %>.email_subject.value =
s;
  
--~--~-~--~~~---~--~~
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: Why does this go nowhere?

2009-06-12 Thread JannaB

yepthat was it (I knew it was something stupid I was doing but
couldnt see it) Thanks Fred! -Janna

On Jun 12, 4:17 pm, Frederick Cheung 
wrote:
> On Jun 12, 8:43 pm, JannaB  wrote:
>
>
>
> > why does nothing change on my screen -- I still see my Send Email
> > form? What am I missing here (it must be so obvious, but I simply
> > don;t see it!) -Janna B
>
> Because you meant to write :update => 'container' but wrote :update =>
> 'contaner' instead ?
>
> If you did mean to write 'contaner', is that the id of an element on
> your page somewhere ?
>
> Lastly, an awesome tool for working with this sort of stuff is Firebug
>
> Fred
--~--~-~--~~~---~--~~
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: Why does this go nowhere?

2009-06-12 Thread JannaB

Thanks fred

On Jun 12, 4:17 pm, Frederick Cheung 
wrote:
> On Jun 12, 8:43 pm, JannaB  wrote:
>
>
>
> > why does nothing change on my screen -- I still see my Send Email
> > form? What am I missing here (it must be so obvious, but I simply
> > don;t see it!) -Janna B
>
> Because you meant to write :update => 'container' but wrote :update =>
> 'contaner' instead ?
>
> If you did mean to write 'contaner', is that the id of an element on
> your page somewhere ?
>
> Lastly, an awesome tool for working with this sort of stuff is Firebug
>
> Fred
--~--~-~--~~~---~--~~
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] Why does this go nowhere?

2009-06-12 Thread JannaB

Ok, I just cant seem to understand this. I have an ActionMailer model:

class Emailer < ActionMailer::Base
 def contact(recipient, subject, message, returnadd, sent_at =
Time.now)
   @subject = subject
   @recipients = recipient
   @from = returnadd
   @sent_on = sent_at
   @body["title"] = 'This is title'
   @body["email"] = 'sen...@yourdomain.com'
   @body["message"] = message
   @headers = {}
   # repl last line and use below to send html email if not set
in /environments/*.rb file:
   # @headers = {content_type => 'text/html'}
end
end

I have a form to implement the model:

Send Email
<% form_remote_tag :update => 'contaner', :url => {:controller =>
'emailer', :action => 'sendmail'}, :html => {:name => 'form'+(params
[:id]).to_s}  do %>
Subject:
<%= text_field 'email', 'subject' %>
Recipient:
<%= text_field 'email', 'recipient',  :readonly => 'true' %>
Message
<%= text_area 'email', 'message' %>
<%= submit_tag "Send" %>
<% end %>

When 'Submit' is clicked, it invokes the sendmail functino in my
EmailerController:

class EmailerController < ApplicationController
  def sendmail
   recipient = params[:email][:recipient]
   subject = params[:email][:subject]
   message = params[:email][:message]
   returnadd = current_associate.email
   mymail = Emailer.create_contact(recipient, subject, message,
returnadd)
   Emailer.deliver(mymail);
  end
end

Which SHOULD then render by /views/emailer/sendmail.erb

Message Sent!

<%=  link_to "Continue", :controller => 'application', :action =>
'home' %>



But NOTHING happens in the view, my log shows that is should be
rendered:

Rendering template within layouts/application
Rendering emailer/sendmail
   [4;35;1mSQL (0.0ms) [0m[0mSELECT count(*) AS count_all FROM
`associates` WHERE (last_request_at > '2009-06-12 15:28:25')  [0m
Rendered layouts/_whereabouts (0.0ms)
Completed in 2578ms (View: 16, DB: 32) | 200 OK [http://127.0.0.1/
emailer/sendmail]

why does nothing change on my screen -- I still see my Send Email
form? What am I missing here (it must be so obvious, but I simply
don;t see it!) -Janna B

--~--~-~--~~~---~--~~
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] modules location

2009-06-12 Thread JannaB

What dir do you typically put modules into your rails apps?
--~--~-~--~~~---~--~~
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: ActionMailer Views Confusion

2009-06-12 Thread JannaB

I'm trying to implement this on a Blackberry (whose support for
Javascript is something of a joke, even when it is enabled) there has
to be a proper way to redirect this in rails which does not involve
javascript. It seems neither  redirect_to nor render get called
(though, the puts line above it does, and the mail is correctly
sent!).

So why can;t a redirect anywhere after this? -Janna B
--~--~-~--~~~---~--~~
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: ActionMailer Views Confusion

2009-06-10 Thread JannaB

Oh waitit;s so easy...just close the div in javascript. Bingo!

On Jun 10, 2:39 pm, JannaB  wrote:
> Frederick
>
> Either one -- but niether get hit:
>
>  def sendmail
>        recipient = params[:email][:recipient]
>        subject = params[:email][:subject]
>        message = params[:email][:message]
>        returnadd = current_associate.email
>        puts "about to send"
>        mymail = Emailer.create_contact(recipient, subject, message,
> returnadd)
>        Emailer.deliver(mymail);
>        puts "sent!"
>        redirect_to :controller => 'application', :action =>
> 'home'
>   end
>
> see, the "sent" is appearingbut nothing ever redirects! Any
> thoughts or suggestions here on this? Thanks! -Janna B
>
> On Jun 10, 1:24 pm, Frederick Cheung 
> wrote:
>
> > On Jun 10, 5:46 pm, JannaB  wrote:> I have an 
> > ActionMailer, which has a corresponding controller (shown
> > > below). The form to create the email gets invoked from another form, a
> > > list of names and email addresses from another Model. I would like to
> > > return to this list after the mail is sent (for now, however, I am
> > > merely trying to return to Application.home() )
>
> > So do you actually want redirect_to rather than render ?
>
> > Fred
>
> > > I have:
>
> > > class EmailerController < ApplicationController
> > >   def sendmail
> > >        recipient = params[:email][:recipient]
> > >        subject = params[:email][:subject]
> > >        message = params[:email][:message]
> > >        returnadd = current_associate.email
> > >        mymail = Emailer.create_contact(recipient, subject, message,
> > > returnadd)
> > >        Emailer.deliver(mymail);
>
> > >     render :controller => 'application', :action => 'home'
>
> > >   end
> > > end
>
> > > Nothing happens -- nothing with the view changes after I click send on
> > > the form that feeds sendmail(), though the sendmail() gets executed
> > > and the mail properly sent. When I look into my logs, I see:
>
> > > -
> > > ActionView::MissingTemplate (Missing template emailer/list.erb in view
> > > path app/views):
> > >   app/controllers/emailer_controller.rb:11:in `sendmail'
>
> > > Rendering rescues/layout (internal_server_error)
> > > 
>
> > > But I do have an application controller and it does have a home
> > > method. Why does ActionMailer not forward onto there in my render
> > > command? How, typically, can I put the view back to what it WAS before
> > > the user elected to send an email ? -Janna B
--~--~-~--~~~---~--~~
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: ActionMailer Views Confusion

2009-06-10 Thread JannaB

Frederick

Either one -- but niether get hit:

 def sendmail
   recipient = params[:email][:recipient]
   subject = params[:email][:subject]
   message = params[:email][:message]
   returnadd = current_associate.email
   puts "about to send"
   mymail = Emailer.create_contact(recipient, subject, message,
returnadd)
   Emailer.deliver(mymail);
   puts "sent!"
   redirect_to :controller => 'application', :action =>
'home'
  end

see, the "sent" is appearingbut nothing ever redirects! Any
thoughts or suggestions here on this? Thanks! -Janna B

On Jun 10, 1:24 pm, Frederick Cheung 
wrote:
> On Jun 10, 5:46 pm, JannaB  wrote:> I have an 
> ActionMailer, which has a corresponding controller (shown
> > below). The form to create the email gets invoked from another form, a
> > list of names and email addresses from another Model. I would like to
> > return to this list after the mail is sent (for now, however, I am
> > merely trying to return to Application.home() )
>
> So do you actually want redirect_to rather than render ?
>
> Fred
>
> > I have:
>
> > class EmailerController < ApplicationController
> >   def sendmail
> >        recipient = params[:email][:recipient]
> >        subject = params[:email][:subject]
> >        message = params[:email][:message]
> >        returnadd = current_associate.email
> >        mymail = Emailer.create_contact(recipient, subject, message,
> > returnadd)
> >        Emailer.deliver(mymail);
>
> >     render :controller => 'application', :action => 'home'
>
> >   end
> > end
>
> > Nothing happens -- nothing with the view changes after I click send on
> > the form that feeds sendmail(), though the sendmail() gets executed
> > and the mail properly sent. When I look into my logs, I see:
>
> > -
> > ActionView::MissingTemplate (Missing template emailer/list.erb in view
> > path app/views):
> >   app/controllers/emailer_controller.rb:11:in `sendmail'
>
> > Rendering rescues/layout (internal_server_error)
> > 
>
> > But I do have an application controller and it does have a home
> > method. Why does ActionMailer not forward onto there in my render
> > command? How, typically, can I put the view back to what it WAS before
> > the user elected to send an email ? -Janna B
--~--~-~--~~~---~--~~
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] ActionMailer Views Confusion

2009-06-10 Thread JannaB

I have an ActionMailer, which has a corresponding controller (shown
below). The form to create the email gets invoked from another form, a
list of names and email addresses from another Model. I would like to
return to this list after the mail is sent (for now, however, I am
merely trying to return to Application.home() )

I have:

class EmailerController < ApplicationController
  def sendmail
   recipient = params[:email][:recipient]
   subject = params[:email][:subject]
   message = params[:email][:message]
   returnadd = current_associate.email
   mymail = Emailer.create_contact(recipient, subject, message,
returnadd)
   Emailer.deliver(mymail);

render :controller => 'application', :action => 'home'

  end
end

Nothing happens -- nothing with the view changes after I click send on
the form that feeds sendmail(), though the sendmail() gets executed
and the mail properly sent. When I look into my logs, I see:

-
ActionView::MissingTemplate (Missing template emailer/list.erb in view
path app/views):
  app/controllers/emailer_controller.rb:11:in `sendmail'

Rendering rescues/layout (internal_server_error)


But I do have an application controller and it does have a home
method. Why does ActionMailer not forward onto there in my render
command? How, typically, can I put the view back to what it WAS before
the user elected to send an email ? -Janna B

--~--~-~--~~~---~--~~
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] Actionamailer

2009-06-10 Thread JannaB

I am using Rails 2.3, and trying to get ActionMailer to work. I have
it configured properly, have followed a very feeble example I have
found ( http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-send-emails.htm
) but I'm kind of stumped on a few things (for one, what is
request.xhr ? I cannot even find this in the API).

Does anyone know a good example for using ActionMailer? I have things
configured ok, I just need a good example to see how the plumbing
works in calling things within rails to move from one view to the next
appropriately, where things are explained for a bimbo like me. -Janna
B


--~--~-~--~~~---~--~~
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] accessing controller variable from view

2009-06-09 Thread JannaB

In my ApplicatoinController I have:

class ApplicationController < ActionController::Base

  MOBILE_USER_AGENTS =  'palm|palmos|palmsource|iphone|blackberry|
nokia|phone|midp|mobi|pda|' +
   'wap|java|nokia|hand|symbian|chtml|wml|
ericsson|lg|audiovox|motorola|' +
   'samsung|sanyo|sharp|telit|tsm|mobile|mini|
windows ce|smartphone|' +
   '240x320|320x320|mobileexplorer|j2me|sgh|
portable|sprint|vodafone|' +
   'docomo|kddi|softbank|pdxgw|j-phone|astel|
minimo|plucker|netfront|' +
   'xiino|mot-v|mot-e|portalmmm|sagem|sie-s|
sie-m|android|ipod'

  def is_mobile_device?
 request.user_agent.to_s.downcase =~ Regexp.new
(MOBILE_USER_AGENTS)
   end

My problem is in my /views/layouts/application.html.erb I have:

 <% if is_mobile_device? %>

I get:

undefined method `is_mobile_device?' for #

How can I refer to is_mobile_device? from this view -- as well as all
views and controllers -- I want to be DRY about this - how can I do
that? -Janna B.
--~--~-~--~~~---~--~~
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: Ruby w/ Apache mod_proxy

2009-06-07 Thread JannaB

But that's not what I want. I need Apache listening on port 80,
routing it to the glassfish gem running on 81 (or any other port other
than 80)

On Jun 7, 12:28 pm, Rick DeNatale  wrote:
> On Sun, Jun 7, 2009 at 9:37 AM, JannaB wrote:
> > So I am trying to mod_proxy the site to the url with port 81 that I
> > know works. Here is how I have the VirtualHost in my httpd.conf file
> > set up:
>
> > 
> >    ServerName gg
> ...
> > 
>
> ...
>
> > whenever I go to hithttp://127.0.0.1/ggI get a 404 not found error.
> > I am certain my document root is correct. Can you fellows here who
> > have done this tell me what I am missing? Thanks, Janna B.
>
> The servername ofhttp://127.0.0.1/ggis not gg but 127.0.0.1 so I'm
> pretty sure that the virtualhost directive isn't having any effect for
> the request.
>
> I'd try adding an entry in /etc/hosts to map gg to 127.0.0.1  and then
> point the browser at
>
> http://gg
>
> and see what happens
>
> --
> Rick DeNatale
>
> Blog:http://talklikeaduck.denhaven2.com/
> Twitter:http://twitter.com/RickDeNatale
> WWR:http://www.workingwithrails.com/person/9021-rick-denatale
> LinkedIn:http://www.linkedin.com/in/rickdenatale
--~--~-~--~~~---~--~~
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: Deployment Question

2009-06-07 Thread JannaB

If I am using only Glassfish, and deploying to say, port 80 how
can I handle multiple sites (multiple rails root dirs) on the same
machine? -JannaB

On Jun 5, 1:12 pm, Vivek Pandey  wrote:
> > Vivek, you might want to create a screencast on how to deploy a Rails
> > application
> > using JRuby and Glassfish.  This will be helpful to others that want to use
> > JRuby
> > as well as disprove some of the negative myths attached to it.
>
> There are several articles/blogs/wikis entries that describe running Rails
> on GlassFish server as well as glassfish gem.
>
> To get started see Charles Nutter blog on "Easy deployment with Glassfish
> gem" at:http://blog.headius.com/2009/04/apache-jruby-rails-glassfish-easy.html
>
> I should have a new screen cast on Deployment of Rails/Merb/Sinatra on
> GlassFish gem soon.
>
> -vivek.
>
>
>
> > -Conrad
--~--~-~--~~~---~--~~
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: Ruby w/ Apache mod_proxy

2009-06-07 Thread JannaB

maybe you cannot do this with Apaqche 1.3.33 ?
--~--~-~--~~~---~--~~
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: Ruby w/ Apache mod_proxy

2009-06-07 Thread JannaB

Fred,

It does not appear to be -- when I check my gg/logs and gg/logs/
mongrel_ debug logs there is nothing mentioning an error here

On Jun 7, 9:42 am, Frederick Cheung 
wrote:
> On Jun 7, 2:37 pm, JannaB  wrote:
>
> > whenever I go to hithttp://127.0.0.1/ggIget a 404 not found error.
> > I am certain my document root is correct. Can you fellows here who
> > have done this tell me what I am missing? Thanks, Janna B.
>
> Who is throwing the 404 ? Is it rails telling you it doesn't have a
> controller called gg ?
>
> Fred
--~--~-~--~~~---~--~~
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: Ruby w/ Apache mod_proxy

2009-06-07 Thread JannaB

I must also mention I have:

LoadModule jk_module modules/mod_jk.so

in httpd.conf
--~--~-~--~~~---~--~~
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] Ruby w/ Apache mod_proxy

2009-06-07 Thread JannaB

Yes, I know this is more specifically an Apache question, but you guys
in this group know this stuff forwards & backwards it seems.

I am running the glassfish gem (in lieu of mongrel) on port 81. If I
go to http://127.0.0.1:81 I get my rails app up beautifully.
Unfortunately, I am also required to have Apache 1.3.33 running on the
production server.

So I am trying to mod_proxy the site to the url with port 81 that I
know works. Here is how I have the VirtualHost in my httpd.conf file
set up:


ServerName gg
DocumentRoot C:/jruby/rails_apps/gg
ProxyPass /gg http://127.0.0.1:81
ProxyPassReverse /gg http://127.0.0.1:81

Order allow,deny
Allow from all



Ive also have unremmed:

LoadModule proxy_module modules/mod_proxy.so
-and-
AddModule mod_proxy.c

whenever I go to hit http://127.0.0.1/gg I get a 404 not found error.
I am certain my document root is correct. Can you fellows here who
have done this tell me what I am missing? Thanks, Janna B.


--~--~-~--~~~---~--~~
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] Missing something about these form parameters

2009-06-06 Thread JannaB

If I have the following form:

Send Email
<% form_remote_tag :update => 'dud', :url => {:controller =>
'emailer', :action => 'sendmail'} do %>
Subject:
<%= text_field 'email', 'subject' %>
Recipient:
<%= text_field 'email', 'recipient' %>
Message
<%= text_area 'email', 'message' %>
<%= submit_tag "Send", {:onclick => "pageLoad()" } %>
<% end %>

Which, upon Submit, executes the following controller method:

class EmailerController < ApplicationController
  def sendmail
   recipient = params[:email]
   subject = params[:subject]
   message = params[:message]
   puts recipient
   puts subject
   puts message
   Emailer.deliver_contact(recipient, subject, message)
   return if request.xhr?
  render :nothing => true
  #render :text => 'Message sent successfully'
  end
end

And I input the following data into the form::
Subject: test
Recipient: a...@123.com
Message: This is just a test!

Why is the output I am puts'ing, look like this?

messageThis is just a test!recipient...@123.comsubjecttest

No wonder I cannot get the mail to send -- why is it prefixing the
variables with the names of the variables themselves? -Janna B

--~--~-~--~~~---~--~~
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] Windows Deployment - what to use

2009-06-06 Thread JannaB

Unfortunately, I must deploy to a windows OS, and, from what I gather
Capistrano just isn't up to the task of that -- not in terms of
configuring it for windows.

Essentially, I am running a rails app in JRuby using the Glassfish gem
as it's (altogether extremely capable) server. So, essentially, I jsut
dump it all in a directory, and fire up the glassfish gem. However,
I'd like the goodies of Capistrano, like being able to have it make
the release out of the svn repository, etc.

Anyone here deploying to Windows? If so, what are you using?
--~--~-~--~~~---~--~~
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 Code Indentation

2009-06-06 Thread JannaB

What do you use asa good RoR editor then?

On Jun 5, 5:22 pm, Hassan Schroeder 
wrote:
> On Fri, Jun 5, 2009 at 2:19 PM, JannaB wrote:
>
> > well, eclipse wont!
>
> Note: the man said "decent" -- eclipse is barely an editor at all... :-)
>
> >> Why not?  Any decent editor will do this for you.
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.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: creating migrations

2009-06-05 Thread JannaB

Thank you. I need this to move it from one db type to another. -Janna
B.

On Jun 5, 11:34 pm, Maurício Linhares 
wrote:
> Configure this legacy database in your database.yml file and then:
>
> rake db:schema:dump
>
> The schema.rb file will contain the legacy database structure.
>
> -
> Maurício Linhareshttp://alinhavado.wordpress.com/(pt-br) 
> |http://codeshooter.wordpress.com/(en)
>
> On Fri, Jun 5, 2009 at 11:25 PM, JannaB wrote:
>
> > So, I guess the answer to my question -- can I create migrations from
> > a given sql schema, is no?
>
> > On Jun 5, 6:30 pm, Norm  wrote:
> >> JannaB wrote:I have a legacy db I need to write a project around. Can 
> >> someone tell me how I can create my migrations from the table structure. 
> >> Can this even be done, or must I create my migrations by hand? Thanks, 
> >> JannaThe purpose of migrations is to create the database tables.  They are 
> >> not really needed for anything else.  If you do not need them to recreate 
> >> the tables you do not need the migrations.
--~--~-~--~~~---~--~~
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: creating migrations

2009-06-05 Thread JannaB

So, I guess the answer to my question -- can I create migrations from
a given sql schema, is no?

On Jun 5, 6:30 pm, Norm  wrote:
> JannaB wrote:I have a legacy db I need to write a project around. Can someone 
> tell me how I can create my migrations from the table structure. Can this 
> even be done, or must I create my migrations by hand? Thanks, JannaThe 
> purpose of migrations is to create the database tables.  They are not really 
> needed for anything else.  If you do not need them to recreate the tables you 
> do not need the migrations.
--~--~-~--~~~---~--~~
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   >