[Rails] Re: Spree on Windows

2009-02-10 Thread MaD

you got a problem with slashes / backslashes as directory separators.
unix uses a slash (and that is what rake expects) while windows uses
backslashes (which are interpreted as escape-characters).
i'm not on windows, so i can't really tell you what to do to fix it,
but i hope i could point you into the right direction to google a
solution.

--~--~-~--~~~---~--~~
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] general iplementation question Do I need polymorphic here

2009-02-10 Thread Sijo Kg

Hi
I have to create a request for an organization and also to create a
request for many Contacts..Now what I do is treating all these in a
single table say request and it has all the fields like
organization_name, contact_name etc Here company_name is at atime one
for a request but contacts are more than one say primary_contacts,other
contacts etc..what my question I tried here a polymorphic relation here
like
class request true
end
class Organization :request
end
class Contact :request
end

But I think this not correct since it makes sense like
orgnization.request  and
contact.requests

  But what I need is the reverse way..(Am I right?)..Please help
to properly arrange this

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

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



[Rails] Re: HABTM & pagination confused

2009-02-10 Thread Master Chief 2007



Abhishek shukla wrote:
> 
> Hello friends,
> 
> Here is my code though which i am getting value
> 
> @students = []
> Seminar.find(params[:id]).students.each do |student|
>   @students << student
> end
> 
> 
> As now i want to implememt pagination.. But no idea how should i
> implement.
> 
> Thanks
> Abhi
> 
> > 
> 
> 

You should explore will_paginate plugin which is what I intend to do in a
few days when I get to my problem.
http://wiki.github.com/mislav/will_paginate

Caveat: I am a noobie to Rails .. just trying to help.
-- 
View this message in context: 
http://www.nabble.com/HABTM---pagination-confused-tp21949213p21949375.html
Sent from the RubyOnRails Users mailing list archive at Nabble.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: rescue_from for NoMethodError

2009-02-10 Thread shahroon ali
Oh Yeah my mistake it was
rescue_from NoMethodError, :with => :show_error
but now I am following this procedure but no success in "NoMethodError"

  rescue_from  NameError, :with => :handle_exceptions
  rescue_from  NoMethodError, :with => :handle_exceptions
  rescue_from  ActiveRecord::Rollback, :with => :handle_exceptions
  rescue_from  ActiveRecord::StatementInvalid, :with => :handle_exceptions
  rescue_from  ActiveRecord::RecordNotFound, :with => :handle_exceptions
  rescue_from  ActionController::UnknownAction, :with => :handle_exceptions
  rescue_from  ActiveRecord::RecordNotFound, :with => :handle_exceptions
  rescue_from  ActiveRecord::StaleObjectError, :with => :handle_exceptions
  rescue_from  ActiveRecord::RecordInvalid, :with => :handle_exceptions
  rescue_from  ActiveRecord::RecordNotSaved, :with => :handle_exceptions
  rescue_from  ActionController::MethodNotAllowed, :with =>
:handle_exceptions
  rescue_from  ActionController::MethodNotAllowed, :with =>
:handle_exceptions
  rescue_from  ActionController::InvalidAuthenticityToken, :with =>
:handle_exceptions

private

  def handle_exceptions
render :action => '500.html',:text => 'This is an error', :status => 500
  end

Any ideas how to solve this problem?

Shahroon

On Tue, Feb 10, 2009 at 9:02 PM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
> On 10 Feb 2009, at 12:14, shahroon ali wrote:
>
> > Hi everyone,
> > I was just trying to catch some exceptions in my
> > app, for "Record Not Found" I used this
> > in my application.rb file
> >   rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
> >   rescue_from ActionController::NoMethodError, :with => :show_error
> >
> > private
> >
> >   def record_not_found
> > render :text => "404 Not Found", :status => 404
> >   end
> >   def show_error(exception)
> > render :text => exception.message;
> >   end
> >
> >
> > and was quite successful but for "NoMethodError" I am trying the
> > same but It isn't working at all. Can anybody help me?
>
> Because ActionController::NoMethodError doesn't exist. It's just plain
> NoMethodError (possibly ::NoMethodError but I don't think that's
> needed here)
>
> Fred
>
> >
> > Thanks in advance,
> > Shahroon
> >
> > >
>
>
> >
>

--~--~-~--~~~---~--~~
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] Spree on Windows

2009-02-10 Thread Maged Makled

hi all , when I tried to run rake db:bootstrap for Spree, I got a weird
error



rake aborted!

Mysql::Error: Can't create/write to file
'C:\WINDOWS\TEMP\#sql_1b0_0.MYI' (Errcode: 13): SHOW FIELDS FROM
`option_values_variants`

rake aborted!

Invalid escape character syntax: /C:\mydirectory\app\Rakefile/


any ideas?

BTW, obvious but I'm using XP

Thanks

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

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



[Rails] HABTM & pagination confused

2009-02-10 Thread Abhishek shukla
Hello friends,

Here is my code though which i am getting value

@students = []
Seminar.find(params[:id]).students.each do |student|
  @students << student
end


As now i want to implememt pagination.. But no idea how should i implement.

Thanks
Abhi

--~--~-~--~~~---~--~~
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] Write checkbox values in database

2009-02-10 Thread Swarna Priya

Hi,

I am new to rails. Any support from your side would be very helpful.

I have a model called child and another model called childcategory. I
have given the code in app/views/children/show.html.erb of child.

<% remote_form_for [...@child, Childcategory.new] do |f| %>

<%= f.label :body, " Allowed Categories " %> 
<% for category in @cat do %>
   <%= check_box 'checkbox', category.categoryname %> <%=
category.categoryname %>
<% end %>
  
 <%= f.submit "Update Settings" %> 
<% end %>


NOw the check boxes are displayed from another model called
Filtercategory. When the user checks a check box in the above view, i
want the check box value to be inserted in a model called Childcategory.
The controller code is as follows.

app/controllers/childcategories_controller.rb

class ChildcategoriesController < ApplicationController

def create
 @child = Child.find(params[:child_id])
 @catlist = @child.childcategories.create!(params[:childcategory])

 respond_to do |format|
   format.html { redirect_to @child }
   format.js
end
   end

end

But  when i submit the "Update Settings" button, a new record is created
with childid but the category name in the check box is not saved in the
table.


Can you say whats the issue. I couldnt solve this.


Any suggestion would be really supportive.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: HowTo install plugins from github?

2009-02-10 Thread Sandeep Sagar
The http counterpart  is what I was searching for but could not find.

I will try to document my travails as a noob to RoR on WinXP and put it on
the wiki.

 

Since I installed the git client and installed my keys, I have been able to
get the plugins I needed.

 

Next up - I will go for will-paginate and see how my "new found" wisdom
helps me :-)

 

Thanks all, as I have been able to move at such a fast pace with all these
plugins as compared to any other stack I know of and I have worked on both
the Java and the .net stacks...

 

  _  

From: rubyonrails-talk@googlegroups.com
[mailto:rubyonrails-t...@googlegroups.com] On Behalf Of David Herman
Sent: Tuesday, February 10, 2009 7:03 PM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Re: HowTo install plugins from github?

 

it should also be noted that most of those plugins that the authors chose to
host with git will have an http counterpart... I think there is some way to
get regular downloads from github

On Tue, Feb 10, 2009 at 6:09 PM, Frederick Cheung
 wrote:


On Feb 10, 10:21 pm, Master Chief 2007  wrote:

> Jason Roelofs wrote:
>
> After a lot of hunting on forums, I found this post which says that I need
> to install this git client! That is not consistent.
>
> :thinking:A gem (git-gem?)dependency I could understand.  but a whole new
> client to keep track off?  Rails doesnt need you to install svn or
Perforce
> or anything right?  You should need these only if you are going to make
> changes to the plug-in

You don't need svn to use rails but then you wouldn't be able to
install plugins hosted via svn.
To say rails requires you to install git is back to front: people
started using git to host the plugins they developed and so some nice
person extended script/plugin to be able to install plugins hosted in
such a manner. If it's anyone's "fault" it's the plugin authors for
using git to host their plugins :-)

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: How to install Rails on CentOS 5.2

2009-02-10 Thread Paryank

Thanks phil,

But I still have the same error.

I have removed my existing ruby package by:

yum remove ruby

And then followed the steps you have mentioned. But when I run command
to install rails first it try to update rubygems. It was taking very
long time. So I have updated rubygems by the following command:

gem update --system

After gem is successfully updated, I tried again to install rails. But
it was giving the same error again:

ERROR:  While executing gem ... (Zlib::DataError)
incorrect header check


On Feb 10, 3:23 pm, phil  wrote:
> Here is what I have - it may be a little old now - from notes to get
> our CentOS sever running.
>
> INSTALLING RUBY ON RAILS:
> =
> 1) Install Ruby
>
> See:http://rubyonrails.org/down
>
> wgethttp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz
> tar -zxvf ruby-1.8.6.tar.gz
> cd ruby-1.8.6
> ./configure --with-openssl-dir=/usr/lib/openssl
> make
> sudo make install
>
> These MAY not be needed. Come back and do them if things don't go
> right in install ruby gems and rails.
> 1a) zlib support
> cd ruby-1.8.6
> ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/
> lib
> make
> sudo make install
>
> 1b) openssl
> cd ruby-1.8.6/ext/openssl
> ruby extconf.rb
> make
> sudo make install
>
> 2) Install ruby gems
> wgethttp://rubyforge.org/frs/download.php/28174/rubygems-0.9.5.tgz
> tar -zxvf rubygems-0.9.5.tgz
> cd rubygems-0.9.5
> sudo ruby setup.rb config
> sudo ruby setup.rb setup
> sudo ruby setup.rb install
>
> 3) Install Rails:
> sudo gem install --version '2.1.0' rails --include-dependencies
>
> 4) Install Mongrel
> sudo gem install mongrel mongrel_cluster
>
> On Feb 10, 11:14 am, Paryank  wrote:
>
> > Thanks for your help. But it still does not work.
>
> > I have downloaded ruby source, compiled and installed. It still gives
> > the same error!
>
> > I do not understand what I am missing!
>
> > On Feb 10, 11:51 am, Xie Hanjian  wrote:
>
> > > Hi Paryank,
>
> > > Though I have no direct solution for you, I think compile/install Ruby
> > > 1.8.7 may solve this problem, while ruby packages on CentOS is obsolete.
>
> > > Jan
>
> > > * Paryank  [2009-02-09 21:29:44 -0800]:
>
> > > > Hi
>
> > > > I have installed CentOS 5.2 on my PC. Ruby 1.8.5 and Ruby-devel
> > > > packages are already installed. I have downloaded rubygems-1.3.1.tgz
> > > > package and installed it. Now I am trying to install Rails by the
> > > > command below:
>
> > > > gem install rails
>
> > > > But it gives me the following error:
>
> > > > ERROR:  While executing gem ... (Zlib::DataError)
> > > >     incorrect header check
>
> > > > zlib and zlib-devel are already installed on my pc. I can install
> > > > other gems like hpricot etc. But still I cannot install rails.
>
> > > > Can somebody please guide me how can I install rails on CentOS?
>
> > > > Thank you,
> > > > Paryank
>
> > > --
> > > jan=callcc{|jan|jan};jan.call(jan)
>
> > >  application_pgp-signature_part
> > > < 1KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Using same partial with diff ajax requests.

2009-02-10 Thread David

Im wondering what the best design implementation with DRY in mind in
the following situation.  I have a number of situations where I am
rendering the same partial with different ajax requests.  For example,
I have an inbox table and I have to link_to_remotes.  One links to
viewing all messages and another links to show a single message.  Im
wondering, does it make sense to use the same partial and create a
variable in the controller which could be used in an if else statement
within the view.  like:

def show
@type = "show"
page.replace_html "inbox_message", :partial => 'message', :locals =>
{:type => @type}
end

def index
@type = "show_all"
page.replace_html "inbox_message", :partial => 'message', :locals =>
{:type => @type}
end

then in the _message partial i could have somehting like:
if @type == "show"
  only show one message
else
  show all messages
end

Is there a better way to do this?  Would just creating two different
partials be any better?  What about any performance issues?

Thanks, Dave
--~--~-~--~~~---~--~~
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] GlassFish Portfolio Announcement

2009-02-10 Thread Mr Magpie

What does the new GlassFish Portfolio
(http://www.sun.com/software/products/glassfish_portfolio/index.jsp?cid=e8021my),
especially the web stack mean for Ruby and Rails ? It would be nice to
have a standard up to date stack to deploy on.

Also, they mention mod_ruby - don't they mean mod_rails ? Maybe they
really want us to use JRuby on the "Enterprise Server" component.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: update + validation error

2009-02-10 Thread David Herman
I think this is a good example of how we should behave on a mailing list...
too many people figure out an answer and never respond back :)  Thanks

On Tue, Feb 10, 2009 at 9:29 PM, Maulin pa  wrote:

>
> > why aren't the validation erros being displayed nicely on update?
>
> I was able to figure this out...If the record was not successfully
> audated because of a validation error, I needed to render :action =>
> :edit.
>
> It now shows the errors nicely.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

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



[Rails] Re: HowTo install plugins from github?

2009-02-10 Thread David Herman
it should also be noted that most of those plugins that the authors chose to
host with git will have an http counterpart... I think there is some way to
get regular downloads from github

On Tue, Feb 10, 2009 at 6:09 PM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
> On Feb 10, 10:21 pm, Master Chief 2007  wrote:
> > Jason Roelofs wrote:
> >
> > After a lot of hunting on forums, I found this post which says that I
> need
> > to install this git client! That is not consistent.
> >
> > :thinking:A gem (git-gem?)dependency I could understand.  but a whole new
> > client to keep track off?  Rails doesnt need you to install svn or
> Perforce
> > or anything right?  You should need these only if you are going to make
> > changes to the plug-in
>
> You don't need svn to use rails but then you wouldn't be able to
> install plugins hosted via svn.
> To say rails requires you to install git is back to front: people
> started using git to host the plugins they developed and so some nice
> person extended script/plugin to be able to install plugins hosted in
> such a manner. If it's anyone's "fault" it's the plugin authors for
> using git to host their plugins :-)
>
> 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: update + validation error

2009-02-10 Thread Maulin pa

> why aren't the validation erros being displayed nicely on update?

I was able to figure this out...If the record was not successfully 
audated because of a validation error, I needed to render :action => 
:edit.

It now shows the errors nicely.

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

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



[Rails] update + validation error

2009-02-10 Thread Maulin pa

I have a Player model with some validations. I am using a partial form
to create and update player info. I have the following like in the view

<%= error_messages_for 'player' %>

On create the validation errors are correctly displayed, but if a
validation error fails update, I get an ugly stack trace error that
looks like this

validation failed: Last name can't be blank

RAILS_ROOT: /home/maulin/projects/sports_ladder
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/validations.rb:1021:in
`save_without_dirty!'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/dirty.rb:87:in
`save_without_transactions!'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:150:in
`save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
`transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in
`transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:138:in
`transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:150:in
`save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:158:in
`rollback_active_record_state!'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:150:in
`save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2476:in
`update_attributes!'
app/controllers/players_controller.rb:41:in `update'

why aren't the validation erros being displayed nicely on update?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: RJS alert with a prototype div

2009-02-10 Thread Chris Habgood
Ok, thanks.  What I am really trying to do is this which I have been banging
my head against:
How do I get the dom id to come in?
The 2nd line prints properly in firebug and shows the value but the first
line just has "#...@next" in it not the value.
Same idea as the alert but an IF condition I think.

page << 'if ($("#...@next}").value == "APS") {'
page[:"#...@next}"].replace_html 'moo'
page << '}'
On Tue, Feb 10, 2009 at 7:23 PM, André l. Leal <
rails-mailing-l...@andreas-s.net> wrote:

>
> Guess you are right... I thought that it might work...
>
> anyway.. you could just stay with raw javascript:
>
> page << "alert($('test_alert').value);"
>
> But I'll try to find a better solution...
>
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

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



[Rails] Re: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread frankjmat...@gmail.com

@Matt
Thank you - the "document database" paradigm is exactly what i was
looking for but didnt know what to call it... Thank you and thank you
again...

@Roy
Thank you for the code snippet you whipped up. I havent had a moment
to work it out and play with it but it most certainly seems to be a
help. Again thanks for the effort.

@Randy,
Thank you for the direction you gave me. I def appreciate that you
took time out to go back and forth with me enough to get my whole
thought out. It was a huge help.

Now i think im going to try my hand at making a stripped down doc-
database implementation in ruby... couchdb looks awesome but waaay too
heavy for my needs.

thanks for the pointers guys

On Feb 10, 8:14 pm, "Pardee, Roy"  wrote:
> I suspect something like this could work--may be worth a shot.
>
> # Models
> class Table < AR:Base
>   has_many :column_groups, :order => 'cg_num'
>   has_many :rows, :order => 'rownum'
>   def columns
>     self.column_groups.map {|cg| cg.columns}
>   end
> end
>
> class ColumnGroup < AR:Base
>   belongs_to :table
>   has_many :columns, :order => 'col_num'
> end
>
> class Column < AR:Base
>   belongs_to :column_group
>   has_many :cells, :order => 'col_num'
> end
>
> class Row < AR:Base
>   belongs_to :table
>   has_many :cells, :order = 'col_num'
>
>   def get_cell(col)
>     # there's almost certainly a faster
>     # way to do this, but this is all that
>     # comes to mind.
>     cells.each do |cell|
>       return cell if cell.column == col
>     end
>     return " "
>   end
>
> end
>
> class Cell < AR:Base
>   belongs_to :row
>   belongs_to :column
> end
>
> # Controller
> class TableController < ApplicationController
>   def show
>     # :include may be useful here if perf is an issue
>     @table = Table.find_by_name(params[:name])
>   end
> end
>
> # View
> 
>   
>     <% @table.column_groups.each do |colgroup| %>
>       ><%= h colgroup.name %>
>     <% end # colgroup %>
>   
>   
>     <% @table.columns.each do |col| %>
>       <%= h col.name %>
>     <% end # col %>
>   
>   <% @table.rows.each do |row| %>
>     
>       <% row.table.columns.each do |col| %>
>         
>           <%= h row.get_cell(col) %>
>         
>       <% end # cell %>
>     
>   <% end # row %>
> 
>
> - Roy
>
> -Original Message-
> From: rubyonrails-talk@googlegroups.com 
> [mailto:rubyonrails-t...@googlegroups.com] On Behalf Of frankjmat...@gmail.com
> Sent: Tuesday, February 10, 2009 7:36 AM
> To: Ruby on Rails: Talk
> Subject: [Rails] Re: sparse tables seems to be an impossible term to search 
> on google
>
> my bottleneck at the moment is "how do i properly merge all this quasi- 
> normal data into an array FROM a rails find"... i can find all the sheets.. i 
> can "find" all the sheets columns, i can find all the columns data... but i 
> cant merge them into one cohesive structure which can then be easily iterated 
> over ie:
>
> please take this for the psudocode that it is.
>
> --table--
>   --thead--
>     --tr--
>       columngroups.each do |columngroup|
>       --th colspan=columngroup.column_count--
>         columngroup.name
>       --/th--
>       end
>     --/tr--
>     --tr--
>       columns.each do |column|
>       --th--
>         column.name
>       --/th--
>       end
>     --/tr--
>   --/thead--
> etc...
>
> my main problem is that the find returns the columns, columngroups etc... are 
> all in random order... i think i need them returned as a key/value so i can 
> align everything properly.. but i dont know.
>
> a sheet is just a way of giving all the columns/rows something to say "hey, 
> this is my parent object"...
>
> On Feb 10, 10:04 am, Randy Kramer  wrote:
> > (top posting and not snipping very much so that somebody else can pick
> > up the thread)--I think I'm out of my depth trying to deal with the
> > best (i.e., fastest) way to deal with your data in Ruby/Rails.  (If I
> > was to hazard a guess, I might try dealing with each table as an
> > array, just for the sake of speed.)
>
> > OTOH, if this is a rails application, presumably there is a client and
> > a server (and TCP/IP communication between them)--is the database
> > processing on the server really the bottleneck?
>
> > At least one more comment interspersed below.
>
> > On Tuesday 10 February 2009 09:37 am, frankjmat...@gmail.com wrote:
>
> > > ive toyed around with just using txt files but my limited
> > > understanding of "proper technique" in dealing with them makes them
> > > just as cumbersome...
>
> > > im very familiar with normalization and if it was practical (and the
> > > cost didnt outweigh the benefit) id make sure everything was
> > > absolutely 6NF and then some... but coulda, woulda, shoulda... its
> > > not practical.. the best im shooting for is 3NF or 4NF but its not a
> > > stringent requirement...
>
> > > i guess you could say i know my way around databases, im just lost
> > > with trying to implement this in a ruby way. my database breakdown
> > > will probably look as fol

[Rails] Re: RJS alert with a prototype div

2009-02-10 Thread André l . Leal

Guess you are right... I thought that it might work...

anyway.. you could just stay with raw javascript:

page << "alert($('test_alert').value);"

But I'll try to find a better solution...


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

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



[Rails] Re: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread Pardee, Roy

I suspect something like this could work--may be worth a shot.

# Models
class Table < AR:Base
  has_many :column_groups, :order => 'cg_num'
  has_many :rows, :order => 'rownum'
  def columns
self.column_groups.map {|cg| cg.columns}
  end
end 

class ColumnGroup < AR:Base
  belongs_to :table
  has_many :columns, :order => 'col_num'
end

class Column < AR:Base
  belongs_to :column_group
  has_many :cells, :order => 'col_num'
end

class Row < AR:Base
  belongs_to :table
  has_many :cells, :order = 'col_num'

  def get_cell(col)
# there's almost certainly a faster 
# way to do this, but this is all that 
# comes to mind.
cells.each do |cell|
  return cell if cell.column == col
end
return " "
  end

end

class Cell < AR:Base
  belongs_to :row
  belongs_to :column
end

# Controller
class TableController < ApplicationController
  def show
# :include may be useful here if perf is an issue
@table = Table.find_by_name(params[:name])
  end
end

# View

  
<% @table.column_groups.each do |colgroup| %>
  ><%= h colgroup.name %>
<% end # colgroup %>
  
  
<% @table.columns.each do |col| %>
  <%= h col.name %>
<% end # col %>
  
  <% @table.rows.each do |row| %>

  <% row.table.columns.each do |col| %>

  <%= h row.get_cell(col) %>

  <% end # cell %>

  <% end # row %>


- Roy

-Original Message-
From: rubyonrails-talk@googlegroups.com 
[mailto:rubyonrails-t...@googlegroups.com] On Behalf Of frankjmat...@gmail.com
Sent: Tuesday, February 10, 2009 7:36 AM
To: Ruby on Rails: Talk
Subject: [Rails] Re: sparse tables seems to be an impossible term to search on 
google


my bottleneck at the moment is "how do i properly merge all this quasi- normal 
data into an array FROM a rails find"... i can find all the sheets.. i can 
"find" all the sheets columns, i can find all the columns data... but i cant 
merge them into one cohesive structure which can then be easily iterated over 
ie:

please take this for the psudocode that it is.

--table--
  --thead--
--tr--
  columngroups.each do |columngroup|
  --th colspan=columngroup.column_count--
columngroup.name
  --/th--
  end
--/tr--
--tr--
  columns.each do |column|
  --th--
column.name
  --/th--
  end
--/tr--
  --/thead--
etc...

my main problem is that the find returns the columns, columngroups etc... are 
all in random order... i think i need them returned as a key/value so i can 
align everything properly.. but i dont know.

a sheet is just a way of giving all the columns/rows something to say "hey, 
this is my parent object"...

On Feb 10, 10:04 am, Randy Kramer  wrote:
> (top posting and not snipping very much so that somebody else can pick 
> up the thread)--I think I'm out of my depth trying to deal with the 
> best (i.e., fastest) way to deal with your data in Ruby/Rails.  (If I 
> was to hazard a guess, I might try dealing with each table as an 
> array, just for the sake of speed.)
>
> OTOH, if this is a rails application, presumably there is a client and 
> a server (and TCP/IP communication between them)--is the database 
> processing on the server really the bottleneck?
>
> At least one more comment interspersed below.
>
> On Tuesday 10 February 2009 09:37 am, frankjmat...@gmail.com wrote:
>
>
>
>
>
> > ive toyed around with just using txt files but my limited 
> > understanding of "proper technique" in dealing with them makes them 
> > just as cumbersome...
>
> > im very familiar with normalization and if it was practical (and the 
> > cost didnt outweigh the benefit) id make sure everything was 
> > absolutely 6NF and then some... but coulda, woulda, shoulda... its 
> > not practical.. the best im shooting for is 3NF or 4NF but its not a 
> > stringent requirement...
>
> > i guess you could say i know my way around databases, im just lost 
> > with trying to implement this in a ruby way. my database breakdown 
> > will probably look as follows (i think, unless someone can point me 
> > in a better direction)...
>
> > over time there may be 5000 sheets... each sheet may have up to 20 
> > columns. each column will eventually belong to exactly one group. 
> > each group may have up to 400 "rows"... .. so if a sheet has 4 
> > columns and
> > 2 groups like my prev. example and is filled to capacity... theres 
> > going to be 400 rows for each set of groups... 800 rows... they need 
> > to then be translated into one cohesive unit for display. the final 
> > display will have all 4 columns separated into groups and "merged" 
> > so all the "toolnumbers" line up in rows.. displaying only 400 rows.
>
> Without a lot more thinking, I don't fully follow the above 
> description. I guess "sheet" is the first thing that puzzles me--is a 
> sheet a table, or is there a table containing up to 5000 sheets?  (Maybe the 
> "schema"
> you list below would answer that and my other questions, but it would 
> p

[Rails] Re: RJS alert with a prototype div

2009-02-10 Thread Chris Habgood
Nope not working.

Showing buildshelf/remove_card.js.rjs where line #6 raised:
  ActionView::Helpers::JavaScriptElementProxy#to_str should
return String


On Tue, Feb 10, 2009 at 7:01 PM, André l. Leal <
rails-mailing-l...@andreas-s.net> wrote:

>
> Chris Habgood wrote:
> > I am trying to do an alert showing the value of a div in an RJS:
> > page.alert("$('slot3').value")
> >
> > It gives me an alert but just shows me what is inside the brackets.
> > $('slot3').value.
> >
> > Any ideas?
>
> How about
> page.alert(page['slot3'].value) ?
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

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



[Rails] Re: Scaling Rails Screencasts

2009-02-10 Thread Robert Walker

Gregg Pollack wrote:
> Hey guys,
> 
>If you're interested in learning more about how to properly Scale a 
> Rails
> app, I just released 7 free Scaling Rails Screencasts which you can view
> here:
> 
>http://railslab.newrelic.com/scaling-rails
> 
>Yes, it is possible, unlike what Jason says on the Rails Envy Podcast
> every week!
> 
>Thanks and hope you find this content useful.
> 
> Gregg Pollack
> Rails Envy

But, everyone knows that Rails can't scale.

Jason.says() == God.says()
=> true

Seriously though. Thanks for all you do for the Rails community. I look 
forward to checking these out.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: RJS alert with a prototype div

2009-02-10 Thread André l . Leal

Chris Habgood wrote:
> I am trying to do an alert showing the value of a div in an RJS:
> page.alert("$('slot3').value")
> 
> It gives me an alert but just shows me what is inside the brackets.
> $('slot3').value.
> 
> Any ideas?

How about
page.alert(page['slot3'].value) ?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Mongrel problem

2009-02-10 Thread Freddy Andersen

First... First I would recommend that you use thin and not mongrel..

Second.. Whats your ruby version? ruby -v

Third... are you able to start one mongrel like so mongrel_rails start
-d ?
--~--~-~--~~~---~--~~
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] RJS alert with a prototype div

2009-02-10 Thread Me

I am trying to do an alert showing the value of a div in an RJS:
page.alert("$('slot3').value")

It gives me an alert but just shows me what is inside the brackets.
$('slot3').value.

Any ideas?


--~--~-~--~~~---~--~~
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: form_remote_for NOT passing param: I want put and I get

2009-02-10 Thread David Herman

Your :method is in the wrong place, it belongs after the first hash, look at 
the docs for the form reote for

-Original Message-
From: Raimon Fs 
Sent: Tuesday, February 10, 2009 5:08 PM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Re: form_remote_for NOT passing param: I want put and I get


Frederick Cheung wrote:
> On 10 Feb 2009, at 18:40, Raimon Fs wrote:
> 
>> doesn't work on 2.2.2, and I started to make changes and changes and
>> read forums and the api, but no way ...
>>
> 
> Random guesses: assuming that the page contains more than just this:
> - are all dom ids unique
> - have you got nested forms ?
> 
> Fred

Here is the .erb file:


<% form_remote_for (:expedient, :method => :put, :url => {:action => 
'create_ajax'}, :update =>'div_listd') do |f| %>
<%= f.error_messages %>




  Referencia
  <%= f.text_field :reference %>
  <%= submit_tag "Añadir" %>





<% end %>



Expedientes listos para ser enviados


  <%= render :partial => "list" %>


<%= link_to 'General', :action => 'index' %> |
<%= link_to 'Back', expedients_path %>

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




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



[Rails] Re: HowTo install plugins from github?

2009-02-10 Thread Frederick Cheung

On Feb 10, 10:21 pm, Master Chief 2007  wrote:
> Jason Roelofs wrote:
>
> After a lot of hunting on forums, I found this post which says that I need
> to install this git client! That is not consistent.
>
> :thinking:A gem (git-gem?)dependency I could understand.  but a whole new
> client to keep track off?  Rails doesnt need you to install svn or Perforce
> or anything right?  You should need these only if you are going to make
> changes to the plug-in

You don't need svn to use rails but then you wouldn't be able to
install plugins hosted via svn.
To say rails requires you to install git is back to front: people
started using git to host the plugins they developed and so some nice
person extended script/plugin to be able to install plugins hosted in
such a manner. If it's anyone's "fault" it's the plugin authors for
using git to host their plugins :-)

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: HowTo install plugins from github?

2009-02-10 Thread Master Chief 2007



Jason Roelofs wrote:
> 
> 
> And the problem is? I mean, script/plugin install git... works exactly
> as expected, if you have git installed and it works like it should.
> 
> Please state what problem you're having instead of just blatantly
> bashing something that works for 99% of the people who try to use it.
> 
> Jason
> > 
> 
Hi
I am a noob on RoR and I will agree that this git dependency came in from
the left field for me too!:confused:

All the documentation I saw about plugins blithely says use the following
command to install plugin -

rubby script/plugin install acts_as_tree
and it works

But when I went to try to install acts_as_authenticated and used -
  ruby script/plugin install
git://github.com/gundestrup/acts_as_authenticated.git
  ruby script/generate authenticated user account

I got the error authenticated not found!

working back I found that nothing had been installed in the plug-ins
directory. AND there was no error message  during the install either.

After a lot of hunting on forums, I found this post which says that I need
to install this git client! That is not consistent.

:thinking:A gem (git-gem?)dependency I could understand.  but a whole new
client to keep track off?  Rails doesnt need you to install svn or Perforce
or anything right?  You should need these only if you are going to make
changes to the plug-in

So thanks for posting this as now I am off to install git  but want to share
my thoughts.

Quoted from: 
http://www.nabble.com/HowTo-install-plugins-from-github--tp21591148p21841502.html

-- 
View this message in context: 
http://www.nabble.com/HowTo-install-plugins-from-github--tp21591148p21939705.html
Sent from the RubyOnRails Users mailing list archive at Nabble.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] Mapping a directory into a database table

2009-02-10 Thread elioncho

Guys I am trying to display a series of directories located on the
server in a tree view. I have seen some solutions for displaying a
tree view based on data on a database but I need to first map my
directory into the database. How can I do this? Also, I want to take
the opportunity to ask if what component to use to display the tree?
(YUI treeview component?)

Thanks,

Elías
--~--~-~--~~~---~--~~
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] what does config.threadsafe! actually do?

2009-02-10 Thread Jonathan Rochkind

Does anyone know what config.threadsafe! actually does, what effect(s)
it has?  I'm even sure where to go looking in the source code for
effects of a config variable like that, but if someone has source to
recommend, I'll give it a shot (although I sometimes have trouble
comprehending AR source, I must admit).

I know it tells Rails to do concurrency request handling. Okay, so far
so good. But I suspect it does other things to to them make Rails behave
differently to support concurrent request handling, rather than simply
remove a mutex around the event loop or whatever.

I ask this because, while I'm not actually interested in concurrent
request handling (don't need it), I _do_ use threads in my Rails app for
other purposes. (Dealing with long-running processes, dealing with
talking to slow external web services).  I'm actually surprised that
nobody else seems to have a use case for this, but in my app it's pretty
crucial.  So I'm trying to figure out what Rails 2.2 can do for me, and
how I'll have to change my Rails 2.1 code to deal with it, etc..  The
changes around supporting threading more intentionally are potentially
good, but the only documentation or writing I can find on it (and very
little of that) assumes you are interested in concurrent request
handling.

Since I'm not, I don't neccesarily want to call config.threadsafe!. But
I'm wondering if there are side effects of config.threadsafe! that I
might want to trigger myself, to make Rails happier about handling
multiple threads (possibly with AR) even without concurrent request
handling.

Anyone have any info to point me to?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] music composer written in rails

2009-02-10 Thread GabrielG1976

Hello Everyone,

I have just Launched Live a new online music composing site.
 That allows you to create new musical compositions based off the
Conversion of text into a midi Composition that can be used in any
software sequencer such as Reason 4 or GarageBand..


Compose Share & Enjoy..

http://text2midi.herokugarden.com

Gabrielg1976


--~--~-~--~~~---~--~~
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] Mongrel problem

2009-02-10 Thread Miquel Oliete

Hi there

I have installed mongrel using rubygems and I have filled the mongrel
configuration file in my rails config directory, which is:

cwd: /var/www/my_http_dir/
log_file: log/mongrel.log
port: "8100"
environment: production
address: 127.0.0.1
pid_file: tmp/pids/mongrel.pid
servers: 2

The problem is that when I try to start mongrel using the command line
order 'mongrel_rails mongrel::start -C config/mongrel_cluster.yml'
appears this error message

** Ruby version is not up-to-date; loading cgi_multipart_eof_fix
** Loading settings
from 
/var/www/ktala/mob1970.org/cheatsheetsandrecipes/config/mongrel_cluster.yml 
(they override command line).
!!! Unknown configuration setting: servers
mongrel::start reported an error. Use mongrel_rails mongrel::start -h
to get help.


Can anybody tell me what is happening? Why servers params is not ok?


Thanks in advance

Regards


Miquel

--~--~-~--~~~---~--~~
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: form_remote_for NOT passing param: I want put and I get

2009-02-10 Thread Raimon Fs

Frederick Cheung wrote:
> On 10 Feb 2009, at 18:40, Raimon Fs wrote:
> 
>> doesn't work on 2.2.2, and I started to make changes and changes and
>> read forums and the api, but no way ...
>>
> 
> Random guesses: assuming that the page contains more than just this:
> - are all dom ids unique
> - have you got nested forms ?
> 
> Fred

Here is the .erb file:


<% form_remote_for (:expedient, :method => :put, :url => {:action => 
'create_ajax'}, :update =>'div_listd') do |f| %>
<%= f.error_messages %>




  Referencia
  <%= f.text_field :reference %>
  <%= submit_tag "Añadir" %>





<% end %>



Expedientes listos para ser enviados


  <%= render :partial => "list" %>


<%= link_to 'General', :action => 'index' %> |
<%= link_to 'Back', expedients_path %>

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

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



[Rails] Re: Ultrasphinx - field is invalid - can't get :filters to work

2009-02-10 Thread Mrknife

I was able to get a 'filter' to work...

basically I used the :concatenate option

is_indexed :fields => ['title','description','created_at'],
  :concatenate => [ {:fields => ['topic_id'], :as
=> 'video_topic_id'} ],
  :delta => {:field => 'created_at'}

Then I was able to run this.

Ultrasphinx::Search.new(:query => "london video_topic_id:
17", :class_names => "Video")

This is in no way ideal...
But I did manage to return the result set I wanted.



On Jan 22, 3:51 am, Stanislav Bozhkov  wrote:
> I had an advice from the Ultrasphinx official forum to try with aliasing
> the topic_id as an unique id name. So I tried this configuration:
>
> is_indexed :fields => ['title','description','created_at',
>                 {:field => 'topic_id', :as => 'video_topic_id'}],
>               :delta => {:field => 'created_at'}
>
> (topic_id is an integer column that is part of Video model)
>
> After that running: rake ulrasphinx:configure; rake ultrasphinx:index;
>
> However the same error occurs:
> --->> Ultrasphinx::Search.new(:query => "london", 
> :class_names => "Video" ).run.total_entries
> => 1
> >> Ultrasphinx::Search.new(:query => "london", :class_names => "Video", 
> >> :filters => {:video_topic_id => 17} ).run.total_entries
>
> Ultrasphinx::UsageError: field "video_topic_id" is invalid
> ---
>
> In case that there's someone who has successfully run a similar task,
> share your configurations, please.
>
>
>
> Stanislav Bozhkov wrote:
> > I can not make it work in any way. I'm dealing with this a whole workday
> > today.
>
> > So, I have tried all of these setups:
> > 
> > class Video < ActiveRecord::Base
> >   ...
> >   belongs_to :topic
> >   ...
> >   is_indexed :fields => ['title','description','created_at'],
> >              :include => [
> >                 {:association_name => 'topic', :field => 'id', :as =>
> > 'topic_id'}
> >               ],
> >               :delta => {:field => 'created_at'}
> >   ...
> > end
>
> > @sphinx = Ultrasphinx::Search.new(:query => "london", :class_names =>
> > "Video", :filters => {:topic_id => 17} ).run.total_entries
>
> > Ultrasphinx::UsageError: field "topic_id" is invalid
>
> > ---
> >   is_indexed :fields => ['title','description','created_at','topic_id'],
>
> > @sphinx = Ultrasphinx::Search.new(:query => "london", :class_names =>
> > "Video", :filters => {:topic_id => 17} ).run.total_entries
>
> > Ultrasphinx::UsageError: field "topic_id" is invalid
>
> > --
> >   is_indexed :fields => ['title','description','created_at'],
> >              :include => [
> >                 {:association_name => 'topic', :field => 'id', :as =>
> > 'topic_id2'}
>
> > @sphinx = Ultrasphinx::Search.new(:query => "london", :class_names =>
> > "Video", :filters => {:topic_id2 => 17} ).run.total_entries
>
> > Ultrasphinx::UsageError: field "topic_id2" is invalid
>
> > --
>
> > After each change of configuration I run
> > rake ultrasphinx:configure
> > rake ultrasphinx:index
>
> > No real results. I just can't make it work with :filters . I'm using
> > ultrasphinx 1.11 .
>
> > Every idea and help is highly appreciated.
>
> > 10x in advance.
>
> --
> 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: Weird error message with restful-authentication plugin

2009-02-10 Thread Marano

I also got this message

On 24 jan, 21:31, Louis-Pierre Dahito  wrote:
> Hey guys,
>
> Every time i install the restful-authentication plugin, it seems to work
> correctly but i always get this error message from my terminal once it
> has finished installing:
>
> Initialized empty Git repository in
> /Users/exponenth/app1/vendor/plugins/restful-authentication/.git/
> remote: Counting objects: 91, done.
> remote: Compressing objects: 100% (79/79), done.
> remote: Total 91 (delta 6), reused 43 (delta 2)
> Unpacking objects: 100% (91/91), done.
> From git://github.com/technoweenie/restful-authentication
>  * branch            HEAD       -> FETCH_HEAD
> Plugin not found:
> ["git://github.com/technoweenie/restful-authentication.git"]
>
> What does it mean  I know there have been some issues lately with
> the plugin regarding NameError Exception but i found nothing about
> "Plugin not found"...
>
> Thank you guys for your help...
>
> Louis-Pierre
> --
> 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: mysql install problem

2009-02-10 Thread David Herman
you might also consider using sudo so it wont install in .gem

On Tue, Feb 10, 2009 at 2:08 PM, Eduardo Cirilo <
rails-mailing-l...@andreas-s.net> wrote:

>
> Done !!!
>
> What a lot of headache :S
>
> Thanks for all m8s...
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

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



[Rails] Re: Constants not visible in controllers or models

2009-02-10 Thread Peter Hickman

Sorry, disregard everything I said. I'm having a blond moment. My  
initialiser scripts were actually .yml files rather than .rb files. So  
the line

AVATARS_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/avatars.yml")

didn't actually do anything. Didn't error either but it's all my fault.

Sorry to waste your time

On 10 Feb 2009, at 12:15, Maurício Linhares wrote:

>
> Where have you defined those constants?
>
> Constants should be accessed with NameOfTheClass::NAME_OF_THE_CONSTANT
>
> -
> Maurício Linhares
> http://alinhavado.wordpress.com/ (pt-br) | http:// 
> blog.codevader.com/ (en)
>
>
>
> On Tue, Feb 10, 2009 at 9:09 AM, Peter Hickman  
>  wrote:
>>
>> Hi,
>>
>> I might be being a bit thick today but I have a problem that I can't
>> seem to shake.
>>
>> I have some configuration data in a yaml file that I load with an
>> initializer.
>>
>> AVATARS_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/avatars.yml")
>>
>> The information includes where to save upload files and other stuff  
>> so
>> it is needed in several places. One of the controllers can reference
>> AVATARS_CONFIG, but the model, avatars.rb cannot. So I have to have
>> the same line in any controller or model that needs it. Which looks  
>> to
>> be very messy not to mention inconsistent - some places need it,  
>> other
>> don't.
>>
>> I've tried to make them global, ie $AVATARS_CONFIG, but it doesn't
>> seem to work.
>>
>> Anyone have any idea how I might get this and other constants I
>> require to be available globally?
>>
>> Thanks
>>
>>
>>>
>>
>
> >


--~--~-~--~~~---~--~~
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] What's the pattern for modularizing / sharing your code?

2009-02-10 Thread Duane Morin

Ok, this is the first time I've run across this, but I think they're
good problems to have :).

I've got a web app out in production.  I've also got a tool for internal
use that manages the reporting on that application.

Problem #1:  What's the best practice out there for sharing the model?
They are entirely separate web apps with entirely different users,
environments, and purpose - but they both manipulate the same business
model.  Surely there is a way to avoid repeating myself?


Problem #2:  With the success of the first production webapp, the boss
said "Ok, now tell us what it would take to do the exact same thing for
our other, differently-branded web site."  Ummmshort of "clone all
the source code" I was a bit stuck for an answer.  Here it seems like
there'd be even more overlap, but I'm not sure about the reality - it
would be all new views, but also at the very least some new
configuration to differentiate it from its twin in the database.  Is
there a better answer there?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: form_remote_for NOT passing param: I want put and I get post

2009-02-10 Thread Frederick Cheung


On 10 Feb 2009, at 18:40, Raimon Fs wrote:

>
> Hello,
>
> I'm struggling my brain with this ajax issue ...
>
> Basically I have a form for creating records, and I want to submit it
> using Ajax.
>
> On previous versions of RoR (2.0.2) it was working, but the same  
> methods
> doesn't work on 2.2.2, and I started to make changes and changes and
> read forums and the api, but no way ...
>

Random guesses: assuming that the page contains more than just this:
- are all dom ids unique
- have you got nested forms ?

Fred
> <% form_remote_for (:expedient, :url => {:action => 'create_ajax'},
> :update =>'div_listd') do |f| %>
>
> 
> 
>  Referencia
>  <%= f.text_field :reference %>
>  <%= submit_tag "Añadir" %>
> 
> 
>
> <% end %>
>
> In the development.log I only see the token param:
>  Parameters:
> {"authenticity_token"=>"c5fb066b9a3370e15f94154cc2140759d40f079c"}
>
>
> the html source code is this:
>
>  style="margin:0;padding:0"> type="hidden" value="c5fb066b9a3370e15f94154cc2140759d40f079c" /> div>
>
> 
>
> 
>  Referencia
>   name="expedient[reference]" size="30" type="text" />
>  
>
> 
>
> 
>
> I see that the method is post, I think it should be 'PUT' to pass the
> variables in the params ... or I'm wrong in this assumption ?
>
> I tried to add the :method => :put but no way . sure I put it in  
> the
> wrong place :-)
>
> thanks again!
>
> r.
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


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



[Rails] Re: fastercsv, freezing into vendor/gems

2009-02-10 Thread bingo bob


you nailed it, thanks!

I dropped the previous code and went with your method.

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

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



[Rails] ActiveSupport::Cache vs. others?

2009-02-10 Thread Marc Byrd
Hi,

We are building and using a new caching gem.  We would like to figure out
how to make this most friendly and easy for both existing projects and new
projects to use.  I'm guessing the best way to get used in new projects
would be via subclassing the ActiveSupport::Cache::Store class?  Is this
expected to be the primary way to use a cache going forward?

What about gems that may be widely used in existing projects like cached_fu,
memcached, etc. ?   Are these expected to be rolled in through
ActiveSupport::Cache over time?

If you had to chose one cache interface to speak (e.g. drop-in replacement,
small constructor diff only, or config diff only), which one would you
suggest?  And if only two, which two?

Thanks,


Marc

--~--~-~--~~~---~--~~
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: ar_mailer issue - emails not getting saved into DB

2009-02-10 Thread Sean Mcgilvray

Where you able to fix this problem? I am having the same issues.

Thank you,

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

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



[Rails] Re: mysql install problem

2009-02-10 Thread Eduardo Cirilo

Done !!!

What a lot of headache :S

Thanks for all m8s...

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

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



[Rails] Re: mysql install problem

2009-02-10 Thread Brent Miller

Check here: http://foliosus.com/blog/howto-install-mysql-gem-on-leopard

Be sure to read the comments -- there is a fix in the comments for the
install command that might help you.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: rendering original view

2009-02-10 Thread bingo bob


am i just going about this in the wrong way?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: mysql install problem

2009-02-10 Thread Eduardo Cirilo

Hi,

I'm still having the problem...here what it says:



Run `rake gems:install` to install the missing gems.
MBPEduCirilo:kshema098 eduardocirilo$ rake gems:install
(in /Users/eduardocirilo/Desktop/kshema098)
gem install mysql
WARNING:  Installing to ~/.gem since /opt/local/lib/ruby/gems/1.8 and
/opt/local/bin aren't both writable.
WARNING:  You don't have /Users/eduardocirilo/.gem/ruby/1.8/bin in your 
PATH,
gem executables will not run.
ERROR:  Error installing mysql:
  ERROR: Failed to build gem native extension.

/opt/local/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
  --with-opt-dir
  --without-opt-dir
  --with-opt-include
  --without-opt-include=${opt-dir}/include
  --with-opt-lib
  --without-opt-lib=${opt-dir}/lib
  --with-make-prog
  --without-make-prog
  --srcdir=.
  --curdir
  --ruby=/opt/local/bin/ruby
  --with-mysql-config
  --without-mysql-config
  --with-mysql-dir
  --without-mysql-dir
  --with-mysql-include
  --without-mysql-include=${mysql-dir}/include
  --with-mysql-lib
  --without-mysql-lib=${mysql-dir}/lib
  --with-mysqlclientlib
  --without-mysqlclientlib
  --with-mlib
  --without-mlib
  --with-mysqlclientlib
  --without-mysqlclientlib
  --with-zlib
  --without-zlib
  --with-mysqlclientlib
  --without-mysqlclientlib
  --with-socketlib
  --without-socketlib
  --with-mysqlclientlib
  --without-mysqlclientlib
  --with-nsllib
  --without-nsllib
  --with-mysqlclientlib
  --without-mysqlclientlib


Gem files will remain installed in 
/Users/eduardocirilo/.gem/ruby/1.8/gems/mysql-2.7 for inspection.
Results logged to 
/Users/eduardocirilo/.gem/ruby/1.8/gems/mysql-2.7/gem_make.out
Building native extensions.  This could take a while...
Loaded suite /opt/local/bin/rake
Started

Finished in 0.000433 seconds.

0 tests, 0 assertions, 0 failures, 0 errors
MBPEduCirilo:kshema098 eduardocirilo$ rake db:migrate
(in /Users/eduardocirilo/Desktop/kshema098)
Missing these required gems:
  mysql

You're running:
  ruby 1.8.7.72 at /opt/local/bin/ruby
  rubygems 1.3.1 at /Users/eduardocirilo/.gem/ruby/1.8, 
/opt/local/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.
MBPEduCirilo:kshema098 eduardocirilo$


What must I do?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] form_remote_for NOT passing param: I want put and I get post

2009-02-10 Thread Raimon Fs

Hello,

I'm struggling my brain with this ajax issue ...

Basically I have a form for creating records, and I want to submit it
using Ajax.

On previous versions of RoR (2.0.2) it was working, but the same methods
doesn't work on 2.2.2, and I started to make changes and changes and
read forums and the api, but no way ...

<% form_remote_for (:expedient, :url => {:action => 'create_ajax'},
:update =>'div_listd') do |f| %>



  Referencia
  <%= f.text_field :reference %>
  <%= submit_tag "Añadir" %>



<% end %>

In the development.log I only see the token param:
  Parameters:
{"authenticity_token"=>"c5fb066b9a3370e15f94154cc2140759d40f079c"}


the html source code is this:






  Referencia
  
  





I see that the method is post, I think it should be 'PUT' to pass the
variables in the params ... or I'm wrong in this assumption ?

I tried to add the :method => :put but no way . sure I put it in the
wrong place :-)

thanks again!

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

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



[Rails] restful authentication: integration testing

2009-02-10 Thread itsastickup


Hi,

Anyone know how to do integration testing with the "Restful
Authentication" plugin?

I've been trying this, without luck :

def login_session(user)
  open_session do |sess|
sess.extend(CustomDsl)
sess.extend(AuthenticatedTestHelper); #

[Rails] Re: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread Matt Jones

To me, there are two possibilities: either switching to a less-
normalized design (serialized columns) or
a different database idea entirely (CouchDB, for instance).

I haven't used CouchDB personally, but check it out:

http://couchdb.apache.org/ (the main project)
http://github.com/arunthampi/activecouch/tree/master (an ActiveRecord-
like wrapper)

It's a "document database", which can store arbitrary key-value pairs
for each "document".
Sounds like it might be a better match for what you're trying to do.
--

Staying within Rails, if you don't have a need to search by specific
column values (which you haven't
mentioned), you could just store the data in a single serialized
field:

Sheets
- id (int)
- name (string)
Columns
- id (int)
- sheet_id (int)
- column_group_id (int)
- name (string)
ColumnGroups
- id (int)
- name (string)
Data
- id (int)
- sheet_id (int)
- tool_number (string)
- row_data (text, serialized)

Then keep the data in Data#row_data, as a Hash of (column_name =>
value) [or column_id => value] pairs.
That would keep all of the ToolNumber stuff grouped together.

BTW, if you need columns in a particular order, take a look at
acts_as_list - it should work great for what
you're doing here.
--

In conclusion (this has gotten rather long), I'd recommend first that
you take a look at CouchDB. It seems
like a much better match to the idea you're looking for. The
serialized-column approach is a little more of a
hack, but should work if nothing else is possible.

--Matt Jones


--~--~-~--~~~---~--~~
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: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread frankjmat...@gmail.com

ive considered it but i still come back to the fundamental problem of
sucking out all the information contained in one "sheet" and
organizing it into a manageable hash or array or whatever would work
best. i think thats where my greatest problem lies.. taking the info
and turning it into one meaningful structure i can loop through.
having everything "sparse" (im using the term to mean.. not every
column of every row will be filled in) seems to make it hard for me to
just merge arrays...

i think...

its getting harder and harder to describe hehehe.

On Feb 10, 12:51 pm, pepe  wrote:
> I am not an expert by any means on this, I am just trying to offer a
> suggestion, but have you thought about storing the data as XML? If you
> do it right you should be able to extract the information you need
> very easily.
>
> Pepe
>
> On Feb 10, 10:35 am, "frankjmat...@gmail.com" 
> wrote:
>
>
>
> > my bottleneck at the moment is "how do i properly merge all this quasi-
> > normal data into an array FROM a rails find"... i can find all the
> > sheets.. i can "find" all the sheets columns, i can find all the
> > columns data... but i cant merge them into one cohesive structure
> > which can then be easily iterated over ie:
>
> > please take this for the psudocode that it is.
>
> > --table--
> >   --thead--
> >     --tr--
> >       columngroups.each do |columngroup|
> >       --th colspan=columngroup.column_count--
> >         columngroup.name
> >       --/th--
> >       end
> >     --/tr--
> >     --tr--
> >       columns.each do |column|
> >       --th--
> >         column.name
> >       --/th--
> >       end
> >     --/tr--
> >   --/thead--
> > etc...
>
> > my main problem is that the find returns the columns, columngroups
> > etc... are all in random order... i think i need them returned as a
> > key/value so i can align everything properly.. but i dont know.
>
> > a sheet is just a way of giving all the columns/rows something to say
> > "hey, this is my parent object"...
>
> > On Feb 10, 10:04 am, Randy Kramer  wrote:
>
> > > (top posting and not snipping very much so that somebody else can pick
> > > up the thread)--I think I'm out of my depth trying to deal with the
> > > best (i.e., fastest) way to deal with your data in Ruby/Rails.  (If I
> > > was to hazard a guess, I might try dealing with each table as an array,
> > > just for the sake of speed.)
>
> > > OTOH, if this is a rails application, presumably there is a client and a
> > > server (and TCP/IP communication between them)--is the database
> > > processing on the server really the bottleneck?
>
> > > At least one more comment interspersed below.
>
> > > On Tuesday 10 February 2009 09:37 am, frankjmat...@gmail.com wrote:
>
> > > > ive toyed around with just using txt files but my limited
> > > > understanding of "proper technique" in dealing with them makes them
> > > > just as cumbersome...
>
> > > > im very familiar with normalization and if it was practical (and the
> > > > cost didnt outweigh the benefit) id make sure everything was
> > > > absolutely 6NF and then some... but coulda, woulda, shoulda... its not
> > > > practical.. the best im shooting for is 3NF or 4NF but its not a
> > > > stringent requirement...
>
> > > > i guess you could say i know my way around databases, im just lost
> > > > with trying to implement this in a ruby way. my database breakdown
> > > > will probably look as follows (i think, unless someone can point me in
> > > > a better direction)...
>
> > > > over time there may be 5000 sheets... each sheet may have up to 20
> > > > columns. each column will eventually belong to exactly one group. each
> > > > group may have up to 400 "rows"... .. so if a sheet has 4 columns and
> > > > 2 groups like my prev. example and is filled to capacity... theres
> > > > going to be 400 rows for each set of groups... 800 rows... they need
> > > > to then be translated into one cohesive unit for display. the final
> > > > display will have all 4 columns separated into groups and "merged" so
> > > > all the "toolnumbers" line up in rows.. displaying only 400 rows.
>
> > > Without a lot more thinking, I don't fully follow the above description.  
> > > I guess "sheet" is the first thing that puzzles me--is a sheet a table,
> > > or is there a table containing up to 5000 sheets?  (Maybe the "schema"
> > > you list below would answer that and my other questions, but it would
> > > probably take me a while to puzzle it out--more time than I have atm.)
>
> > > If I really wanted to understand it, I'd ask for an example using "real"
> > > data--sheets, columns, and rows just confuse me (would that be
> > > metadata?).
>
> > > > i **think** i understand the database side.. im lost on the ruby
> > > > implementation (or any implementation).. is there a "most effective"
> > > > way to construct my relationships?
>
> > > > Sheets
> > > > - id (int)
> > > > - name (string)
>
> > > > Columns
> > > > - id (int)
> > > > - sheet_id (int)
> > > > - column_grou

[Rails] Re: test if an external url is valid before redirecting to it?

2009-02-10 Thread Max Williams

That's perfect, thanks Andrew.

You're probably right about testing the validity at the point of adding 
it rather than (or as well as) the redirect.  I think i'll put a remote 
test button next to the input field, and maybe call it automatically on 
change of the field.

Anyway, thanks again.
max
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: scaffold macro problem

2009-02-10 Thread Frederick Cheung


On 10 Feb 2009, at 17:30, Adeel Shahzad wrote:

>
> Frederick Cheung wrote:
>> On 10 Feb 2009, at 17:04, Adeel Shahzad wrote:
>>>
>>> development:
>>> adapter: mysql
>>> encoding: utf8
>>> database: MovieApp_development
>>> pool: 5
>>> username:root
>>
>> the space (or rather lack of space) between username and root is
>> significant
>>
>> Fred
>
> Thanx Fred. But the thing is that database is created in DB using the
> same database.yml and the same database.yml is not working for  
> scaffold.
>
> I have seen, there is no issue with spaces.

I suggest you try again - I can replicate the exact error you get with  
my apps by removing the space after the :
Those spaces are important in yaml, as is indentation
Fred

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


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



[Rails] Re: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread pepe

I am not an expert by any means on this, I am just trying to offer a
suggestion, but have you thought about storing the data as XML? If you
do it right you should be able to extract the information you need
very easily.

Pepe

On Feb 10, 10:35 am, "frankjmat...@gmail.com" 
wrote:
> my bottleneck at the moment is "how do i properly merge all this quasi-
> normal data into an array FROM a rails find"... i can find all the
> sheets.. i can "find" all the sheets columns, i can find all the
> columns data... but i cant merge them into one cohesive structure
> which can then be easily iterated over ie:
>
> please take this for the psudocode that it is.
>
> --table--
>   --thead--
>     --tr--
>       columngroups.each do |columngroup|
>       --th colspan=columngroup.column_count--
>         columngroup.name
>       --/th--
>       end
>     --/tr--
>     --tr--
>       columns.each do |column|
>       --th--
>         column.name
>       --/th--
>       end
>     --/tr--
>   --/thead--
> etc...
>
> my main problem is that the find returns the columns, columngroups
> etc... are all in random order... i think i need them returned as a
> key/value so i can align everything properly.. but i dont know.
>
> a sheet is just a way of giving all the columns/rows something to say
> "hey, this is my parent object"...
>
> On Feb 10, 10:04 am, Randy Kramer  wrote:
>
> > (top posting and not snipping very much so that somebody else can pick
> > up the thread)--I think I'm out of my depth trying to deal with the
> > best (i.e., fastest) way to deal with your data in Ruby/Rails.  (If I
> > was to hazard a guess, I might try dealing with each table as an array,
> > just for the sake of speed.)
>
> > OTOH, if this is a rails application, presumably there is a client and a
> > server (and TCP/IP communication between them)--is the database
> > processing on the server really the bottleneck?
>
> > At least one more comment interspersed below.
>
> > On Tuesday 10 February 2009 09:37 am, frankjmat...@gmail.com wrote:
>
> > > ive toyed around with just using txt files but my limited
> > > understanding of "proper technique" in dealing with them makes them
> > > just as cumbersome...
>
> > > im very familiar with normalization and if it was practical (and the
> > > cost didnt outweigh the benefit) id make sure everything was
> > > absolutely 6NF and then some... but coulda, woulda, shoulda... its not
> > > practical.. the best im shooting for is 3NF or 4NF but its not a
> > > stringent requirement...
>
> > > i guess you could say i know my way around databases, im just lost
> > > with trying to implement this in a ruby way. my database breakdown
> > > will probably look as follows (i think, unless someone can point me in
> > > a better direction)...
>
> > > over time there may be 5000 sheets... each sheet may have up to 20
> > > columns. each column will eventually belong to exactly one group. each
> > > group may have up to 400 "rows"... .. so if a sheet has 4 columns and
> > > 2 groups like my prev. example and is filled to capacity... theres
> > > going to be 400 rows for each set of groups... 800 rows... they need
> > > to then be translated into one cohesive unit for display. the final
> > > display will have all 4 columns separated into groups and "merged" so
> > > all the "toolnumbers" line up in rows.. displaying only 400 rows.
>
> > Without a lot more thinking, I don't fully follow the above description.  
> > I guess "sheet" is the first thing that puzzles me--is a sheet a table,
> > or is there a table containing up to 5000 sheets?  (Maybe the "schema"
> > you list below would answer that and my other questions, but it would
> > probably take me a while to puzzle it out--more time than I have atm.)
>
> > If I really wanted to understand it, I'd ask for an example using "real"
> > data--sheets, columns, and rows just confuse me (would that be
> > metadata?).
>
> > > i **think** i understand the database side.. im lost on the ruby
> > > implementation (or any implementation).. is there a "most effective"
> > > way to construct my relationships?
>
> > > Sheets
> > > - id (int)
> > > - name (string)
>
> > > Columns
> > > - id (int)
> > > - sheet_id (int)
> > > - column_group_id (int)
> > > - name (string)
>
> > > ColumnGroups
> > > - id (int)
> > > - name (string)
>
> > > Data
> > > - id (int)
> > > - sheet_id (int)
> > > - column_id (int)
> > > - tool_number (string)
> > > - value (int)
>
> > > then i'll have a possible array as such for a query like:
> > > select tool_number, value from data where sheet_id = x
>
> > > whats an effective way to iterate over the returned dataset and sort
> > > it out into its corresponding columns column groups and rows... im
> > > seeing a join in my head but i dont know on what.
>
> > > :(
>
> > > hopefully my problem is becoming a little more clear... but the deeper
> > > i dig the more i suspect theres an elegent solution im not advanced
> > > enough to see.
>
> > Good luck!
> > Randy Kram

[Rails] Re: Active Record Associations

2009-02-10 Thread James Bond

Rey wrote:
> If I understand correctly what you need, a computer may belong to many
> users and one user can have many computer, right? same for phones, I
> assume.

Yes

> In this case, the relationship is :has_and_belongs_to_many, but you do

How can I find all users whose name is "James%" and their computers (not 
mobiles)?

User.find(:all, ??)
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: fastercsv, freezing into vendor/gems

2009-02-10 Thread Matt Jones



On Feb 9, 11:25 am, bingo bob 
wrote:
> I made a little progress..
> I went to vendor/
> mkdir gems
> went in there
> and unpacked fastercsvsent it to my webhost...
>
> However on the webhost the line require 'fastercsv' still fails.
>
> I read on joyent knoweldeg base running this in environment.rb might do
> it...
>
> config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
>   File.directory?(lib = "#{dir}/lib") ? lib : dir
> end
>
> Will that code above solve the problem, claims to search within
> vendor/gems!
>

That code *may* work, but it will probably confuse the gem loader a
little. The
problem you're having is that the 2.2 vendor gem handling stuff isn't
loaded
until the environment is; if your rake task looks like this:

task "do_something" => :environment do

end

Then move the require line *inside* the task, which should pick up the
unpacked gem.

Hope this helps!

--Matt Jones


--~--~-~--~~~---~--~~
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: test if an external url is valid before redirecting to it?

2009-02-10 Thread Andrew Timberlake
On Tue, Feb 10, 2009 at 6:56 PM, Max Williams <
rails-mailing-l...@andreas-s.net> wrote:

>
> In our site, users can have a url associated with their account to which
> they are redirected when their login expires.  This can differ from user
> to user, and is prone to being mis-copied, or the sites in question not
> being there any more etc.  I'd like to test if the url is valid before
> sending the user on to it.
>
> So, i want, in the controller, to do something like this -
>
> if external_url_is_valid?(user.expiry_url)
>  redirect_to user.expiry_url
> else
>  redirect_to "our_default_expiry_page"
> end
>
> Can anyone tell me a nice, simple and efficient way of doing the
> "external_url_is_valid?" bit?
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
require 'net/http'
require 'uri'

def external_url_is_valid?(url)
  uri = URI.parse(url)
  response = Net::HTTP.start(uri.host, uri.port) {|http|
http.head(uri.path)}
  response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPRedirection)
end

Watch the validity of the url - www.google.com is not valid
http://www.google.com also won't work, http://www.google.com/ will

I wouldn't do this at the point of redirection, I would do it at the point
of saving the redirection url

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain

--~--~-~--~~~---~--~~
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: Anyone familiar with Bort? How is it supposed to be used?

2009-02-10 Thread Freddy Andersen

You are right Bort is not a noob app, but its very easy to setup.



* Download and unzip Bort
* Edit the database.yml and the settings.yml files
* Changed the default password in the bort migration
* Edit the REST_AUTH_SITE_KEY in each of the environment files
* Rake db:migrate
* Have a brew and celebrate

That's from the Bort site. Is there something in particular that is
breaking? I have used Bort and other apps like it many times as the
base for my applications just to get a jump start on the basic
functions...
--~--~-~--~~~---~--~~
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: scaffold macro problem

2009-02-10 Thread Adeel Shahzad

Frederick Cheung wrote:
> On 10 Feb 2009, at 17:04, Adeel Shahzad wrote:
>>
>> development:
>>  adapter: mysql
>>  encoding: utf8
>>  database: MovieApp_development
>>  pool: 5
>>  username:root
> 
> the space (or rather lack of space) between username and root is
> significant
> 
> Fred

Thanx Fred. But the thing is that database is created in DB using the 
same database.yml and the same database.yml is not working for scaffold.

I have seen, there is no issue with spaces.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Suppressing log messages for an action

2009-02-10 Thread Brent Miller

Have you looked at BufferedLogger#silence?

http://apidock.com/rails/ActiveSupport/BufferedLogger/silence

Adam wrote:
> Hi all,
> 
> I have a rails app that regularly pings the server to check for
> changes. The problem I'm having is that my "ping" action is printing
> so much output to the log that it's swamping any useful data. Is there
> a way to turn off the log for a specific action? Ideally I'd like it
> to print to the log only if there's an error, but I'd be quite happy
> to just turn off the log altogether for the ping action. I'm using the
> default Rails logger.
> 
> Many thanks,
> Adam

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

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



[Rails] Re: ActionController::InvalidAuthenticityToken?

2009-02-10 Thread Raimon Fs

pete wrote:
> Ah, ok, so the suggestion is to add a hidden field with the <%=
> form_authenticity_token %> in it?
> 
> Thanks again, I've been messing with this all day...


Did you solved your problem ?

I'm having the same trouble, but in my source html page I can see the 
token there:




No matter wich action I I call, it never fires. I suppose Rails is 
intercepting and stopping it because the token problem.

any ideas ?

thanks,

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

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



[Rails] Re: It does not load de image from picasa

2009-02-10 Thread Colin Law
2009/1/29 Esdras Mayrink 

> Hello everbody.
>
> I'm trying to load images from my picasa webalbum in my rails app.
>
> So, this is the image url:
>
> http://lh4.ggpht.com/_PjuQJCqPYIk/SYDrJz34UiI/AT0/KUvS_-XPE8A/sunset-1600.jpg
>
> When I do  />, or image_tag( ... ) it does not load the image, and Firebug says it was
> not found. But when I do it in a simple .html file out of a rails app. it
> loads the image correctly.



Have you tried viewing the page source and copying the  out
and into your simple html page just to check there is not some subtle
difference in the url string?



>
>
> the most intrigant  thing is that the thumbnail of the same image loads
> correctly in both, rails app and the .html file.
> This is the URL of a thumbnail of the image:
> http://lh4.ggpht.com/_PjuQJCqPYIk/SYDrJz34UiI/AT0/KUvS_-XPE8A/s144/sunset-1600.jpg
>
> I'm using rails 2.2.2 and this happened in production mode (I didn't test
> it in production mode).
>
> Can somebody figure out what is going on?
>
> Any help will be appreciated.
>
> >
>

--~--~-~--~~~---~--~~
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: [ANN] The end of Capchas: Thorny Form plugin

2009-02-10 Thread Wybo Wiersma

> > It is not an unbreakable solution, but it is likely to continue to
> > work for quite some time. The following joke from Ned Batchelders blog
> > nicely sketches why:
> 
> For what's worth, Nanoki, a wiki engine implemented in Lua, uses Ned  
> Batchelders tricks to keep itself spam free.
> 
> For an illustration, check the source of the various form:
> 
> http://svr225.stepx.com:3388/main/editor
> http://svr225.stepx.com:3388/cloud/editor

Thanks for providing these links.

Feedback on the Rails plugin
(http://www.logilogi.org/pub/doc/plugins/thorny_form/)
is most welcome.

It is used in http://www.LogiLogi.org (both for remarks and logis/
documents)

Wybo Wiersma

---

::Student:
- Informatiekunde (computer linguistics, IR, webtech), History and Philosophy
- Member of the Center for Metahistory Groningen (http://www.rug.nl/let/cmg)

::Free Software and Open Source Developer:
- Active in the LogiLogi Foundation (http://foundation.logilogi.org)
- http://www.LogiLogi.org, Cumulative, shared commenting, publication and
   idea sharing: Where insight comes together...
- ComLinToo, a computational linguistics toolset written in Perl

--~--~-~--~~~---~--~~
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: scaffold macro problem

2009-02-10 Thread Frederick Cheung


On 10 Feb 2009, at 17:04, Adeel Shahzad wrote:
>
> development:
>  adapter: mysql
>  encoding: utf8
>  database: MovieApp_development
>  pool: 5
>  username:root

the space (or rather lack of space) between username and root is  
significant

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: executing a generator on the browser

2009-02-10 Thread elioncho

Yes it works great, thanks a lot Rey!

On Feb 10, 11:58 am, Rey  wrote:
> My advice stands.
> You'll need to call the generator using system
> e.g.: system(script/generate blah blah parameters here)
> selecting a target directory could be another story, if this generator
> does not accept a target as a parameter. how about moving the
> generated files after you've run the command?
>
> Regards,
> Rey
>
> On 10 Feb, 15:48,bbtosurf wrote:
>
> > Hello Rey and thanks for your answer. This generator belongs to a gem.
> > So the idea is that when a user is browing my website and click on a
> > specific button this generator should be executed and directory of
> > files is created on his personal folder on the server (this folder is
> > created when a user signs up)
>
> > Thanks,
>
> > Elías
>
> > On Feb 10, 8:10 am, Rey  wrote:
>
> > > I'm not sure of what you're asking, but if this 'generator' is an
> > > application residing on the server running your web application, you
> > > can call it using the ruby command system('executable_name').
>
> > > regards,
> > > rey
>
> > > On 10 Feb, 01:01,bbtosurf wrote:
>
> > > > Hi
>
> > > > I currently have a generator which creates a directory of files. I
> > > > want clients on my app to be able to execute that generator and save
> > > > those files in their personal folder on the server. The thing is that
> > > > I have always executed this generator via terminal and it always
> > > > creates the series of files on the current path on the terminal where
> > > > I executed the command. How can a user execute this generator on the
> > > > browser and the files be created in his personal folder.
>
> > > > thanx
--~--~-~--~~~---~--~~
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] config.default_timezone vs. config.time_zone

2009-02-10 Thread James Byrne

In config/environment.rb are these statements equivalent?

config.default_timezone = :utc
config.time_zone = "UTC"

If not, then how do they differ in effect?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: config.default_timezone vs. config.time_zone

2009-02-10 Thread James Byrne

James Byrne wrote:

Should have been:

> In config/environment.rb are these statements equivalent?
> 
> config.active_record.default_timezone = :utc
> config.time_zone = "UTC"
> 
> If not, then how do they differ in effect?

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

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



[Rails] scaffold macro problem

2009-02-10 Thread Adeel Shahzad

Hello,

I am using Komodo Edit 5.0 for ROR. I have made the database by using
the macros in it. But when I make model using sacffold, I get error. The
details are given below:

C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 22, col
2: `  password:' (ArgumentError)
  from C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load'
  from
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:819:in
`database_configuration'
  from
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:391:in
`initialize_database'
  from
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:139:in
`process'
  from
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in
`send'
  from
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in
`run'
  from E:/ror/MovieApp/config/environment.rb:13
  from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/generate.rb:1
  from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from script/generate:3



My database.yml is given below

# MySQL.  Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
#   gem install mysql
# On Mac OS X:
#   sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
# On Mac OS X Leopard:
#   sudo env ARCHFLAGS="-arch i386" gem install mysql --
--with-mysql-config=/usr/local/mysql/bin/mysql_config
#   This sets the ARCHFLAGS environment variable to your native
architecture
# On Windows:
#   gem install mysql
#   Choose the win32 build.
#   Install MySQL and put its /bin directory on your path.
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: mysql
  encoding: utf8
  database: MovieApp_development
  pool: 5
  username:root
  password:
  host: localhost

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  encoding: utf8
  database: MovieApp_test
  pool: 5
  username: root
  password:
  host: localhost

production:
  adapter: mysql
  encoding: utf8
  database: MovieApp_production
  pool: 5
  username: root
  password:
  host: localhost



Please help me in tis regard.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: It does not load de image from picasa

2009-02-10 Thread Femi

I have exactly the same problem. In both IE as FF. Is there anyone who
has a solution for this?

Any help is welcome

--~--~-~--~~~---~--~~
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 a generator on the browser

2009-02-10 Thread Rey9999

My advice stands.
You'll need to call the generator using system
e.g.: system(script/generate blah blah parameters here)
selecting a target directory could be another story, if this generator
does not accept a target as a parameter. how about moving the
generated files after you've run the command?

Regards,
Rey


On 10 Feb, 15:48, bbtosurf  wrote:
> Hello Rey and thanks for your answer. This generator belongs to a gem.
> So the idea is that when a user is browing my website and click on a
> specific button this generator should be executed and directory of
> files is created on his personal folder on the server (this folder is
> created when a user signs up)
>
> Thanks,
>
> Elías
>
> On Feb 10, 8:10 am, Rey  wrote:
>
> > I'm not sure of what you're asking, but if this 'generator' is an
> > application residing on the server running your web application, you
> > can call it using the ruby command system('executable_name').
>
> > regards,
> > rey
>
> > On 10 Feb, 01:01,bbtosurf wrote:
>
> > > Hi
>
> > > I currently have a generator which creates a directory of files. I
> > > want clients on my app to be able to execute that generator and save
> > > those files in their personal folder on the server. The thing is that
> > > I have always executed this generator via terminal and it always
> > > creates the series of files on the current path on the terminal where
> > > I executed the command. How can a user execute this generator on the
> > > browser and the files be created in his personal folder.
>
> > > thanx
--~--~-~--~~~---~--~~
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] test if an external url is valid before redirecting to it?

2009-02-10 Thread Max Williams

In our site, users can have a url associated with their account to which
they are redirected when their login expires.  This can differ from user
to user, and is prone to being mis-copied, or the sites in question not
being there any more etc.  I'd like to test if the url is valid before
sending the user on to it.

So, i want, in the controller, to do something like this -

if external_url_is_valid?(user.expiry_url)
  redirect_to user.expiry_url
else
  redirect_to "our_default_expiry_page"
end

Can anyone tell me a nice, simple and efficient way of doing the
"external_url_is_valid?" bit?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Active Record Associations

2009-02-10 Thread Rey9999

If I understand correctly what you need, a computer may belong to many
users and one user can have many computer, right? same for phones, I
assume.

In this case, the relationship is :has_and_belongs_to_many, but you do
not need the classes OwnComputer and the other one. you just need two
tables (without id) which will contain, for each record, a couple of
id identifying one coupling (user-computer for one table, user-phone
for the other).
have a look at:
http://wiki.rubyonrails.org/rails/pages/has_and_belongs_to_many
for naming conventions.

Regards,

Rey

On 10 Feb, 15:31, James Bond  wrote:
> I have tables:
>
> users (id, name)
> computers (id, name)
> mobiltelefons (id, name)
>
> OwnComputers (id, user_id, computer_id)
> OwnMobiltelefons (id, user_id, mobiltelefon_id)
>
> So is it  has_many :through or has_and_belongs_to_many or what?
>
> I only need to search one "own" table at time:
> All computers that user "xx" owns OR
> All Mobiltelefons that user "xx" owns OR
> who owns mobilitefon "zz" OR
> who owns computer "yy"
>
> So...
>
> class Computers < ActiveRecord::Base
>   has_many :OwnComputer
>   has_many :user, :through => :OwnComputer
> end
>
> class OwnComputers < ActiveRecord::Base
>   belongs_to :Computer
>   belongs_to :User
> end
>
> class Users < ActiveRecord::Base
>   ???
> end
>
> class Mobiltelefons < ActiveRecord::Base
>   ???
> end
>
> class OwnMobiltelefons < ActiveRecord::Base
>   ???
> end
> --
> 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: Testing on Linux VM on winXP 3 times faster than XP

2009-02-10 Thread Sazima

So in the end you gave up on the virtual machine and are running Linux
directly, is that it?

Cheers, Sazima

On Feb 9, 1:37 pm, Phlip  wrote:
> > Can you please elaborate on the setup you mentioned?
>
> I am ashamed to.
>
> > > You should try Vista. I experimented with Qemu and Puppy-Linux
> > > recently, and everything was faster.
>
> I like some of Vista's toys. Things like a functional Hibernate mode.
>
> So I tried qemu-puppy on a USB drive. It worked great, but SeaMonkey,
> the only functioning browser, instantly died with a silly .so file
> error as soon as I ever tried to do anything. So, instead of
> dedicating the rest of my career to learning how to mix and match
> puppy sfs files (with the usual impossible online forum support), I
> just switched to a dual-boot with Kubuntu. It will do fine with half a
> hard-drive.
>
> When puppy, in qemu, possibly with kqemu, was doing things like
> building Ruby in less than a minute, instead of 15 minutes or so. Of
> course the Kubuntu is faster.
>
> Any volunteers to go work for MS? To help them clean up their
> codebase? I didn't think so... (-:
>
> --
>   Phlip
--~--~-~--~~~---~--~~
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: Pretty Record Lists

2009-02-10 Thread Sazima

Hey Chad,

Check the WiceGrid Plugin. Never used, but seems to be what you want:

https://redmine.wice.eu/wiki/wice-grid

Cheers, Sazima

On Feb 9, 8:12 pm, Chad  wrote:
> Can anyone recommend a lightweight plugin that renders lists of
> records nicely with ajax sort, pagination, edit/delete links, etc?  I
> tried ActiveScaffold, which is really great, but it's too much for
> what I'm trying to accomplish.
>
> Ideally it would be used sorta like this (similar to AS):
>
> controller:
> @users = company.users
>
> view:
> <%= render :pretty_lists => @users %>
>
> --
> Thanks for any help,
> Chad
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] How to achieve STI has_many :through referencing to the same STI

2009-02-10 Thread satynos

I have the base Content model from which all the types of the contents
such as page, post, asset descend as follows:

class Content < ActiveRecord::Base
end

class Page < Content
end

class Post < Content
end

class Asset < Content
end

Now I am trying to accomplish relationships between all these contents
using a relationship table as follows:

class Relationship < ActiveRecord::Base
  belongs_to :content, :polymorphic => true
  belongs_to :target, :polymorphic => true
end

Accordingly I updated the base models to reflect the relationships as
follows:

class Page < Content
 has_many :relationships, :as => :content
 has_many :posts, :through => :relationships, :source
=> :target, :source_type => "Post"
 has_many :assets, :through => :relationships, :source
=> :target, :source_type => "Asset"
end

class Post < Content
 has_many :relationships, :as => :content
 has_many :pages, :through => :relationships, :source
=> :target, :source_type => "Page"
 has_many :assets, :through => :relationships, :source
=> :target, :source_type => "Asset"
end

class Asset < Content
 has_many :relationships, :as => :content
 has_many :pages, :through => :relationships, :source
=> :target, :source_type => "Page"
 has_many :posts, :through => :relationships, :source
=> :target, :source_type => "Post"
end

But when I try to access @page.assets, I am getting empty array. In
looking at the log file, I see the reason being the following query:

SELECT `contents`.* FROM `contents`
INNER JOIN relationships ON contents.id = relationships.target_id
AND relationships.target_type = 'Asset'
WHERE (`relationships`.content_id = #{id} ) AND (`contents`.`type` =
'Asset')

The problem is due to the highlighted portion of the query. When the
active record saves a relationship, it is saving the content_type and
target_type as "Content" (the base model class) instead of the actual
content type "Page" or "Post" or "Asset".

Is there any way possible to achieve what I am trying without any
plugins? How can I tell ActiveRecord to save the content_type and
target_type of the relationship with the actual class name instead of
the base class name?

BTW: I looked into has_many_polymorphs, but it doesn't quite solve my
problem.

Thanks in advance.
-Satynos

--~--~-~--~~~---~--~~
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: rescue_from for NoMethodError

2009-02-10 Thread Frederick Cheung


On 10 Feb 2009, at 12:14, shahroon ali wrote:

> Hi everyone,
> I was just trying to catch some exceptions in my  
> app, for "Record Not Found" I used this
> in my application.rb file
>   rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
>   rescue_from ActionController::NoMethodError, :with => :show_error
>
> private
>
>   def record_not_found
> render :text => "404 Not Found", :status => 404
>   end
>   def show_error(exception)
> render :text => exception.message;
>   end
>
>
> and was quite successful but for "NoMethodError" I am trying the  
> same but It isn't working at all. Can anybody help me?

Because ActionController::NoMethodError doesn't exist. It's just plain  
NoMethodError (possibly ::NoMethodError but I don't think that's  
needed here)

Fred

>
> Thanks in advance,
> Shahroon
>
> >


--~--~-~--~~~---~--~~
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: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread frankjmat...@gmail.com

my bottleneck at the moment is "how do i properly merge all this quasi-
normal data into an array FROM a rails find"... i can find all the
sheets.. i can "find" all the sheets columns, i can find all the
columns data... but i cant merge them into one cohesive structure
which can then be easily iterated over ie:

please take this for the psudocode that it is.

--table--
  --thead--
--tr--
  columngroups.each do |columngroup|
  --th colspan=columngroup.column_count--
columngroup.name
  --/th--
  end
--/tr--
--tr--
  columns.each do |column|
  --th--
column.name
  --/th--
  end
--/tr--
  --/thead--
etc...

my main problem is that the find returns the columns, columngroups
etc... are all in random order... i think i need them returned as a
key/value so i can align everything properly.. but i dont know.

a sheet is just a way of giving all the columns/rows something to say
"hey, this is my parent object"...

On Feb 10, 10:04 am, Randy Kramer  wrote:
> (top posting and not snipping very much so that somebody else can pick
> up the thread)--I think I'm out of my depth trying to deal with the
> best (i.e., fastest) way to deal with your data in Ruby/Rails.  (If I
> was to hazard a guess, I might try dealing with each table as an array,
> just for the sake of speed.)
>
> OTOH, if this is a rails application, presumably there is a client and a
> server (and TCP/IP communication between them)--is the database
> processing on the server really the bottleneck?
>
> At least one more comment interspersed below.
>
> On Tuesday 10 February 2009 09:37 am, frankjmat...@gmail.com wrote:
>
>
>
>
>
> > ive toyed around with just using txt files but my limited
> > understanding of "proper technique" in dealing with them makes them
> > just as cumbersome...
>
> > im very familiar with normalization and if it was practical (and the
> > cost didnt outweigh the benefit) id make sure everything was
> > absolutely 6NF and then some... but coulda, woulda, shoulda... its not
> > practical.. the best im shooting for is 3NF or 4NF but its not a
> > stringent requirement...
>
> > i guess you could say i know my way around databases, im just lost
> > with trying to implement this in a ruby way. my database breakdown
> > will probably look as follows (i think, unless someone can point me in
> > a better direction)...
>
> > over time there may be 5000 sheets... each sheet may have up to 20
> > columns. each column will eventually belong to exactly one group. each
> > group may have up to 400 "rows"... .. so if a sheet has 4 columns and
> > 2 groups like my prev. example and is filled to capacity... theres
> > going to be 400 rows for each set of groups... 800 rows... they need
> > to then be translated into one cohesive unit for display. the final
> > display will have all 4 columns separated into groups and "merged" so
> > all the "toolnumbers" line up in rows.. displaying only 400 rows.
>
> Without a lot more thinking, I don't fully follow the above description.  
> I guess "sheet" is the first thing that puzzles me--is a sheet a table,
> or is there a table containing up to 5000 sheets?  (Maybe the "schema"
> you list below would answer that and my other questions, but it would
> probably take me a while to puzzle it out--more time than I have atm.)
>
> If I really wanted to understand it, I'd ask for an example using "real"
> data--sheets, columns, and rows just confuse me (would that be
> metadata?).
>
>
>
>
>
> > i **think** i understand the database side.. im lost on the ruby
> > implementation (or any implementation).. is there a "most effective"
> > way to construct my relationships?
>
> > Sheets
> > - id (int)
> > - name (string)
>
> > Columns
> > - id (int)
> > - sheet_id (int)
> > - column_group_id (int)
> > - name (string)
>
> > ColumnGroups
> > - id (int)
> > - name (string)
>
> > Data
> > - id (int)
> > - sheet_id (int)
> > - column_id (int)
> > - tool_number (string)
> > - value (int)
>
> > then i'll have a possible array as such for a query like:
> > select tool_number, value from data where sheet_id = x
>
> > whats an effective way to iterate over the returned dataset and sort
> > it out into its corresponding columns column groups and rows... im
> > seeing a join in my head but i dont know on what.
>
> > :(
>
> > hopefully my problem is becoming a little more clear... but the deeper
> > i dig the more i suspect theres an elegent solution im not advanced
> > enough to see.
>
> Good luck!
> Randy Kramer
> --
> I didn't have time to write a short letter, so I created a video
> instead.--with apologies to Cicero, et.al.- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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,

[Rails] Anyone familiar with Bort? How is it supposed to be used?

2009-02-10 Thread Ralph Wood

Noob here, obviously.

I checked Bort out and was left a bit confused. It seems everything I
try to do either breaks or interferes with some of its default
configurations and plugins.

I realize Bort is intended for people who already know their way around
an app, and what they are doing, and not as a shortcut for noobs, but I
am really intrigued, and would like to have a better idea of how to even
begin playing with it.

So if someone could provide a quick sort of "checklist" of how to get
things rolling properly with it, I would appreciate.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread Randy Kramer

(top posting and not snipping very much so that somebody else can pick 
up the thread)--I think I'm out of my depth trying to deal with the 
best (i.e., fastest) way to deal with your data in Ruby/Rails.  (If I 
was to hazard a guess, I might try dealing with each table as an array, 
just for the sake of speed.)

OTOH, if this is a rails application, presumably there is a client and a 
server (and TCP/IP communication between them)--is the database 
processing on the server really the bottleneck?

At least one more comment interspersed below.

On Tuesday 10 February 2009 09:37 am, frankjmat...@gmail.com wrote:
> ive toyed around with just using txt files but my limited
> understanding of "proper technique" in dealing with them makes them
> just as cumbersome...
> 
> im very familiar with normalization and if it was practical (and the
> cost didnt outweigh the benefit) id make sure everything was
> absolutely 6NF and then some... but coulda, woulda, shoulda... its not
> practical.. the best im shooting for is 3NF or 4NF but its not a
> stringent requirement...
> 
> i guess you could say i know my way around databases, im just lost
> with trying to implement this in a ruby way. my database breakdown
> will probably look as follows (i think, unless someone can point me in
> a better direction)...
> 
> over time there may be 5000 sheets... each sheet may have up to 20
> columns. each column will eventually belong to exactly one group. each
> group may have up to 400 "rows"... .. so if a sheet has 4 columns and
> 2 groups like my prev. example and is filled to capacity... theres
> going to be 400 rows for each set of groups... 800 rows... they need
> to then be translated into one cohesive unit for display. the final
> display will have all 4 columns separated into groups and "merged" so
> all the "toolnumbers" line up in rows.. displaying only 400 rows.

Without a lot more thinking, I don't fully follow the above description.  
I guess "sheet" is the first thing that puzzles me--is a sheet a table, 
or is there a table containing up to 5000 sheets?  (Maybe the "schema" 
you list below would answer that and my other questions, but it would 
probably take me a while to puzzle it out--more time than I have atm.)

If I really wanted to understand it, I'd ask for an example using "real" 
data--sheets, columns, and rows just confuse me (would that be 
metadata?).

> i **think** i understand the database side.. im lost on the ruby
> implementation (or any implementation).. is there a "most effective"
> way to construct my relationships?
> 
> Sheets
> - id (int)
> - name (string)
> 
> Columns
> - id (int)
> - sheet_id (int)
> - column_group_id (int)
> - name (string)
> 
> ColumnGroups
> - id (int)
> - name (string)
> 
> Data
> - id (int)
> - sheet_id (int)
> - column_id (int)
> - tool_number (string)
> - value (int)
> 
> then i'll have a possible array as such for a query like:
> select tool_number, value from data where sheet_id = x
> 
> whats an effective way to iterate over the returned dataset and sort
> it out into its corresponding columns column groups and rows... im
> seeing a join in my head but i dont know on what.
> 
> :(
> 
> hopefully my problem is becoming a little more clear... but the deeper
> i dig the more i suspect theres an elegent solution im not advanced
> enough to see.

Good luck!
Randy Kramer
-- 
I didn't have time to write a short letter, so I created a video 
instead.--with apologies to Cicero, et.al.

--~--~-~--~~~---~--~~
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 a generator on the browser

2009-02-10 Thread bbtosurf

Hello Rey and thanks for your answer. This generator belongs to a gem.
So the idea is that when a user is browing my website and click on a
specific button this generator should be executed and directory of
files is created on his personal folder on the server (this folder is
created when a user signs up)

Thanks,

Elías

On Feb 10, 8:10 am, Rey  wrote:
> I'm not sure of what you're asking, but if this 'generator' is an
> application residing on the server running your web application, you
> can call it using the ruby command system('executable_name').
>
> regards,
> rey
>
> On 10 Feb, 01:01,bbtosurf wrote:
>
> > Hi
>
> > I currently have a generator which creates a directory of files. I
> > want clients on my app to be able to execute that generator and save
> > those files in their personal folder on the server. The thing is that
> > I have always executed this generator via terminal and it always
> > creates the series of files on the current path on the terminal where
> > I executed the command. How can a user execute this generator on the
> > browser and the files be created in his personal folder.
>
> > thanx
--~--~-~--~~~---~--~~
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: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread frankjmat...@gmail.com

ive toyed around with just using txt files but my limited
understanding of "proper technique" in dealing with them makes them
just as cumbersome...

im very familiar with normalization and if it was practical (and the
cost didnt outweigh the benefit) id make sure everything was
absolutely 6NF and then some... but coulda, woulda, shoulda... its not
practical.. the best im shooting for is 3NF or 4NF but its not a
stringent requirement...

i guess you could say i know my way around databases, im just lost
with trying to implement this in a ruby way. my database breakdown
will probably look as follows (i think, unless someone can point me in
a better direction)...

over time there may be 5000 sheets... each sheet may have up to 20
columns. each column will eventually belong to exactly one group. each
group may have up to 400 "rows"... .. so if a sheet has 4 columns and
2 groups like my prev. example and is filled to capacity... theres
going to be 400 rows for each set of groups... 800 rows... they need
to then be translated into one cohesive unit for display. the final
display will have all 4 columns separated into groups and "merged" so
all the "toolnumbers" line up in rows.. displaying only 400 rows.

i **think** i understand the database side.. im lost on the ruby
implementation (or any implementation).. is there a "most effective"
way to construct my relationships?

Sheets
- id (int)
- name (string)

Columns
- id (int)
- sheet_id (int)
- column_group_id (int)
- name (string)

ColumnGroups
- id (int)
- name (string)

Data
- id (int)
- sheet_id (int)
- column_id (int)
- tool_number (string)
- value (int)

then i'll have a possible array as such for a query like:
select tool_number, value from data where sheet_id = x

whats an effective way to iterate over the returned dataset and sort
it out into its corresponding columns column groups and rows... im
seeing a join in my head but i dont know on what.

:(

hopefully my problem is becoming a little more clear... but the deeper
i dig the more i suspect theres an elegent solution im not advanced
enough to see.

On Feb 10, 8:59 am, Randy Kramer  wrote:
> On Tuesday 10 February 2009 08:31 am, frankjmat...@gmail.com wrote:
>
> > What I'm really looking for is a technical explaination of the
> correct/
> > incorrect way to acheive this... I'm sure it's a problem that someone,
> > somewhere had to solve once before and I've been trying to reinvent
> > it, as i said - with separate tables for the columns, column groups,
> > rows, tables... but in the end - merging all the tables together and
> > iterating over everything just seems to take forever... not in the
> > least bit efficient or reliable.
>
> Well, I sort of stand by my original response then.  I mean, when you
> have an unnormalized relational database and responses are too slow,
> the typical recommendation (I think) is to normalize the database.  I
> won't try to explain that here, you need to look it up.  (Maybe someone
> can explain it (and how to do it) simply, but I can't, at least not at
> this time.)
>
> Normalizing the database is not the only way forward however, and I'd
> ask how much data you have.  For my only (in progress) application, a
> relational database is just not the right fit, and in general slows
> everything down (in comparison to plain text files and "ordinary" (and
> indexed) searches).  (My application has plain text files with
> (currently) up to 5000 variable length records per file, totalling on
> the order of 10,000,000 characters per file.  At them moment I have
> about 12 such files, although only two are that big.  I plan to scale
> to files as big as 100,000,000 characters without switching to a
> relational data base (which I'm sure would slow down my application).
>
> How much data will you have in this(these) table(s)?  For a low quantity
> of data, maybe even a spreadsheet "technology" would do the job?
>
> Other solutions, like a separate machine (server) to handle the database
> could help as well.  I guess someone would need more information,
> specifically about the quantity of data involved (now and in the
> future).
>
> Randy Kramer
> --
> I didn't have time to write a short letter, so I created a video
> instead.--with apologies to Cicero, et.al.
--~--~-~--~~~---~--~~
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] Active Record Associations

2009-02-10 Thread James Bond

I have tables:

users (id, name)
computers (id, name)
mobiltelefons (id, name)

OwnComputers (id, user_id, computer_id)
OwnMobiltelefons (id, user_id, mobiltelefon_id)

So is it  has_many :through or has_and_belongs_to_many or what?

I only need to search one "own" table at time:
All computers that user "xx" owns OR
All Mobiltelefons that user "xx" owns OR
who owns mobilitefon "zz" OR
who owns computer "yy"

So...

class Computers < ActiveRecord::Base
  has_many :OwnComputer
  has_many :user, :through => :OwnComputer
end

class OwnComputers < ActiveRecord::Base
  belongs_to :Computer
  belongs_to :User
end

class Users < ActiveRecord::Base
  ???
end

class Mobiltelefons < ActiveRecord::Base
  ???
end

class OwnMobiltelefons < ActiveRecord::Base
  ???
end
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Best Way to detect if you are in a migration?

2009-02-10 Thread MaD

i once had a similar problem. in my case i wanted to skip some code
whenever it is called from a rake task. back then i solved it the way
Frantisek Psotka proposed. still working, no problems. just set your
ENV-variable at the beginning of your rake task.
--~--~-~--~~~---~--~~
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: Best Way to detect if you are in a migration?

2009-02-10 Thread Maurício Linhares

Create your own class that inherits ActiveRecord::Migration and use
it, defining the behavior you would like to have.

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Mon, Feb 9, 2009 at 5:11 PM, Frantisek Psotka
 wrote:
>
> I im interested in this question, has somebody the answer?
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

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



[Rails] Re: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread Randy Kramer

On Tuesday 10 February 2009 08:31 am, frankjmat...@gmail.com wrote:
> What I'm really looking for is a technical explaination of the 
correct/
> incorrect way to acheive this... I'm sure it's a problem that someone,
> somewhere had to solve once before and I've been trying to reinvent
> it, as i said - with separate tables for the columns, column groups,
> rows, tables... but in the end - merging all the tables together and
> iterating over everything just seems to take forever... not in the
> least bit efficient or reliable.

Well, I sort of stand by my original response then.  I mean, when you 
have an unnormalized relational database and responses are too slow, 
the typical recommendation (I think) is to normalize the database.  I 
won't try to explain that here, you need to look it up.  (Maybe someone 
can explain it (and how to do it) simply, but I can't, at least not at 
this time.)

Normalizing the database is not the only way forward however, and I'd 
ask how much data you have.  For my only (in progress) application, a 
relational database is just not the right fit, and in general slows 
everything down (in comparison to plain text files and "ordinary" (and 
indexed) searches).  (My application has plain text files with 
(currently) up to 5000 variable length records per file, totalling on 
the order of 10,000,000 characters per file.  At them moment I have 
about 12 such files, although only two are that big.  I plan to scale 
to files as big as 100,000,000 characters without switching to a 
relational data base (which I'm sure would slow down my application).

How much data will you have in this(these) table(s)?  For a low quantity 
of data, maybe even a spreadsheet "technology" would do the job?

Other solutions, like a separate machine (server) to handle the database 
could help as well.  I guess someone would need more information, 
specifically about the quantity of data involved (now and in the 
future).

Randy Kramer
-- 
I didn't have time to write a short letter, so I created a video 
instead.--with apologies to Cicero, et.al.

--~--~-~--~~~---~--~~
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: Best Way to detect if you are in a migration?

2009-02-10 Thread Frantisek Psotka

Hey guys, i've not tested it, but:

1. you are able to set environment variable when runing rake from 
commandline

2. you are able to test against ENV[:variable] in your code.

3. problem solved? :)

here is the inspiration:

http://ryandaigle.com/articles/2007/6/22/using-command-line-parameters-w-rake-and-capistrano
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread frankjmat...@gmail.com

Once again I hit send a little premature.

What I'm really looking for is a technical explaination of the correct/
incorrect way to acheive this... I'm sure it's a problem that someone,
somewhere had to solve once before and I've been trying to reinvent
it, as i said - with separate tables for the columns, column groups,
rows, tables... but in the end - merging all the tables together and
iterating over everything just seems to take forever... not in the
least bit efficient or reliable.

On Feb 10, 8:28 am, "frankjmat...@gmail.com" 
wrote:
> ah, thank you. any response - even yours - feels good. i realize this
> isnt the most thoroughly explained post so here goes.
>
> i have a need allow my program to create and store variable column
> data much like the sense of a spreadsheet where at any given time,
> only a handful of columns will be accessed - but over the lifetime of
> the "spreadsheet" (table seems too broad a term for me), all the
> columns and all the rows will slowly become filled. if you would
> imagine this scenario:
>
> UserA defines/"creates" TableOne.
> TableOne has ColumnOne, ColumnTwo, ColumnThree, ColumnFour.
> UserB needs access to ColumnOne and ColumnTwo recognized as
> ColumnGroupOne.
> UserC needs access to ColumnThree and ColumnFour recognized as
> ColumnGroupTwo.
>
> now the row count is generally fixed (not truely fixed but not
> sporatic) but isnt known in advance. rows are not identified by their
> primary key but by another column called "ToolNumber" which is
> specified in the ColumnGroup.
>
> UserA and UserB may be modifying a record that names the same
> ToolNumber and ultimately, upon the table/spreadsheets completion -
> will all be consolidated into one master sheet which contains all Rows
> and ColumnGroups merged into one table displayed for the user or print
> or whatever.
>
> Hopefully that gives you a better idea of what im asking for.
>
> Sparse tables may be a meaningful term but I am most certainly
> stretching the definition so that may be a point of confusion and I
> understand that.
>
> Many thanks,
> - FJM
>
> On Feb 10, 7:46 am, Randy Kramer  wrote:
>
>
>
> > On Tuesday 10 February 2009 12:05 am, frankjmat...@gmail.com wrote:
>
> > > ive asked this question a half a dozen different ways and none have
> > > ever gotten an answer.
>
> > (Just an aside--is everybody switching to top posting--where's the
> > context, what's the question--must I read the rest of the post to find
> > the question?  (Sorry, I'm in a funky mood, on another list I read,
> > some guy quoted a long post, and somewhere in the middle of it posted a
> > short phrase response (less than a line).  What a pain.)
>
> > Anyway, after skimming the rest of the post, I'm not entirely sure of
> > your question:
>
> >    * do you want pointers on how to search for "sparse tables" on
> > google, or
> >    * do you want help on storing "variable column sparse tables"--ahh, I
> > didn't see the variable column part the first time I skimmed
>
> > Anyway, before I saw that, I was going to say that a relational data
> > base (which is what Rails uses (iiuc, something like MySQL, Postgresql
> > (??), or whatever, is something like a sparse table because tables
> > don't have to be "complete"--for example, if the key field is some
> > numerical index, you can have records 001, 006, and 046--you don't have
> > to have a line for every record from 001 thru 046.
>
> > But I guess that's not what you mean by "variable column sparse tables".  
> > So what do you mean?  You mean where (starting with my sparse example
> > above ;-), some records (lines) do not have a value for every column?  
> > Maybe something like this:
>
> > View in fixed font:
> > key    lastname   firstname   height  weight   hatsize   shoesize
> > 001      Mattia       Frank         5'11"                 7 1/4       10
> > 006      Doe          John           5'6"      165            
> > 046                      Jane           5'5"
>
> > If that's what you're looking for, as far as I know, tables like this
> > can exist in a relational data base and not really cause any problem.  
> > A pedant would (I think) make some comment about the data not being
> > fully normalized, and maybe some slightly less efficiency that would be
> > experienced if you had many (i.e., thousands, millions) of such
> > records.
>
> > OTOH, normalizing the database (typically) takes effort both by the
> > programmer / database administrator and in the database itself (running
> > queries or whatever to actually accomplish the normalization, so for
> > small quantities of data (I would argue that) it is not efficient to
> > normalize the data.  
>
> > > > afaik i need a table for my rows
> > > > a table for my columns
> > > > a table for cells.
> > > > and a table of "tables"
>
> > I haven't thought through what the above is about, but at a quick skim
> > it sounds like the kind of tables and effort that would be needed to
> > normalize the database.  Like I s

[Rails] Re: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread frankjmat...@gmail.com

ah, thank you. any response - even yours - feels good. i realize this
isnt the most thoroughly explained post so here goes.

i have a need allow my program to create and store variable column
data much like the sense of a spreadsheet where at any given time,
only a handful of columns will be accessed - but over the lifetime of
the "spreadsheet" (table seems too broad a term for me), all the
columns and all the rows will slowly become filled. if you would
imagine this scenario:

UserA defines/"creates" TableOne.
TableOne has ColumnOne, ColumnTwo, ColumnThree, ColumnFour.
UserB needs access to ColumnOne and ColumnTwo recognized as
ColumnGroupOne.
UserC needs access to ColumnThree and ColumnFour recognized as
ColumnGroupTwo.

now the row count is generally fixed (not truely fixed but not
sporatic) but isnt known in advance. rows are not identified by their
primary key but by another column called "ToolNumber" which is
specified in the ColumnGroup.

UserA and UserB may be modifying a record that names the same
ToolNumber and ultimately, upon the table/spreadsheets completion -
will all be consolidated into one master sheet which contains all Rows
and ColumnGroups merged into one table displayed for the user or print
or whatever.

Hopefully that gives you a better idea of what im asking for.

Sparse tables may be a meaningful term but I am most certainly
stretching the definition so that may be a point of confusion and I
understand that.

Many thanks,
- FJM

On Feb 10, 7:46 am, Randy Kramer  wrote:
> On Tuesday 10 February 2009 12:05 am, frankjmat...@gmail.com wrote:
>
> > ive asked this question a half a dozen different ways and none have
> > ever gotten an answer.
>
> (Just an aside--is everybody switching to top posting--where's the
> context, what's the question--must I read the rest of the post to find
> the question?  (Sorry, I'm in a funky mood, on another list I read,
> some guy quoted a long post, and somewhere in the middle of it posted a
> short phrase response (less than a line).  What a pain.)
>
> Anyway, after skimming the rest of the post, I'm not entirely sure of
> your question:
>
>    * do you want pointers on how to search for "sparse tables" on
> google, or
>    * do you want help on storing "variable column sparse tables"--ahh, I
> didn't see the variable column part the first time I skimmed
>
> Anyway, before I saw that, I was going to say that a relational data
> base (which is what Rails uses (iiuc, something like MySQL, Postgresql
> (??), or whatever, is something like a sparse table because tables
> don't have to be "complete"--for example, if the key field is some
> numerical index, you can have records 001, 006, and 046--you don't have
> to have a line for every record from 001 thru 046.
>
> But I guess that's not what you mean by "variable column sparse tables".  
> So what do you mean?  You mean where (starting with my sparse example
> above ;-), some records (lines) do not have a value for every column?  
> Maybe something like this:
>
> View in fixed font:
> key    lastname   firstname   height  weight   hatsize   shoesize
> 001      Mattia       Frank         5'11"                 7 1/4       10
> 006      Doe          John           5'6"      165            
> 046                      Jane           5'5"
>
> If that's what you're looking for, as far as I know, tables like this
> can exist in a relational data base and not really cause any problem.  
> A pedant would (I think) make some comment about the data not being
> fully normalized, and maybe some slightly less efficiency that would be
> experienced if you had many (i.e., thousands, millions) of such
> records.
>
> OTOH, normalizing the database (typically) takes effort both by the
> programmer / database administrator and in the database itself (running
> queries or whatever to actually accomplish the normalization, so for
> small quantities of data (I would argue that) it is not efficient to
> normalize the data.  
>
> > > afaik i need a table for my rows
> > > a table for my columns
> > > a table for cells.
> > > and a table of "tables"
>
> I haven't thought through what the above is about, but at a quick skim
> it sounds like the kind of tables and effort that would be needed to
> normalize the database.  Like I said, for some definitions of small,
> this is counterproductive for small quantities of data (imho).
>
> If your question is something else, maybe you can clarify.
>
> Randy Kramer
> --
> I didn't have time to write a short letter, so I created a video
> instead.--with apologies to Cicero, et.al.
--~--~-~--~~~---~--~~
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 a generator on the browser

2009-02-10 Thread Rey9999

I'm not sure of what you're asking, but if this 'generator' is an
application residing on the server running your web application, you
can call it using the ruby command system('executable_name').

regards,
rey

On 10 Feb, 01:01, bbtosurf  wrote:
> Hi
>
> I currently have a generator which creates a directory of files. I
> want clients on my app to be able to execute that generator and save
> those files in their personal folder on the server. The thing is that
> I have always executed this generator via terminal and it always
> creates the series of files on the current path on the terminal where
> I executed the command. How can a user execute this generator on the
> browser and the files be created in his personal folder.
>
> thanx
--~--~-~--~~~---~--~~
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] Scaling Rails Screencasts

2009-02-10 Thread Gregg Pollack
Hey guys,

   If you're interested in learning more about how to properly Scale a Rails
app, I just released 7 free Scaling Rails Screencasts which you can view
here:

   http://railslab.newrelic.com/scaling-rails

   Yes, it is possible, unlike what Jason says on the Rails Envy Podcast
every week!

   Thanks and hope you find this content useful.

Gregg Pollack
Rails Envy

--~--~-~--~~~---~--~~
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: sparse tables seems to be an impossible term to search on google

2009-02-10 Thread Randy Kramer

On Tuesday 10 February 2009 12:05 am, frankjmat...@gmail.com wrote:
> ive asked this question a half a dozen different ways and none have
> ever gotten an answer.

(Just an aside--is everybody switching to top posting--where's the 
context, what's the question--must I read the rest of the post to find 
the question?  (Sorry, I'm in a funky mood, on another list I read, 
some guy quoted a long post, and somewhere in the middle of it posted a 
short phrase response (less than a line).  What a pain.)

Anyway, after skimming the rest of the post, I'm not entirely sure of 
your question:

   * do you want pointers on how to search for "sparse tables" on 
google, or
   * do you want help on storing "variable column sparse tables"--ahh, I 
didn't see the variable column part the first time I skimmed

Anyway, before I saw that, I was going to say that a relational data 
base (which is what Rails uses (iiuc, something like MySQL, Postgresql 
(??), or whatever, is something like a sparse table because tables 
don't have to be "complete"--for example, if the key field is some 
numerical index, you can have records 001, 006, and 046--you don't have 
to have a line for every record from 001 thru 046.

But I guess that's not what you mean by "variable column sparse tables".  
So what do you mean?  You mean where (starting with my sparse example 
above ;-), some records (lines) do not have a value for every column?  
Maybe something like this:

View in fixed font:
keylastname   firstname   height  weight   hatsize   shoesize
001  Mattia   Frank 5'11" 7 1/4   10 
006  Doe  John   5'6"  165
046  Jane   5'5"

If that's what you're looking for, as far as I know, tables like this 
can exist in a relational data base and not really cause any problem.  
A pedant would (I think) make some comment about the data not being 
fully normalized, and maybe some slightly less efficiency that would be 
experienced if you had many (i.e., thousands, millions) of such 
records.

OTOH, normalizing the database (typically) takes effort both by the 
programmer / database administrator and in the database itself (running 
queries or whatever to actually accomplish the normalization, so for 
small quantities of data (I would argue that) it is not efficient to 
normalize the data.  

> > afaik i need a table for my rows
> > a table for my columns
> > a table for cells.
> > and a table of "tables"

I haven't thought through what the above is about, but at a quick skim 
it sounds like the kind of tables and effort that would be needed to 
normalize the database.  Like I said, for some definitions of small, 
this is counterproductive for small quantities of data (imho).

If your question is something else, maybe you can clarify.

Randy Kramer
-- 
I didn't have time to write a short letter, so I created a video 
instead.--with apologies to Cicero, et.al.

--~--~-~--~~~---~--~~
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] Gmailer -Help me

2009-02-10 Thread Poornima Dhanasekar

I have installed gmailer gem.but i got some error when i tried to 
connect
my gmail account.i need to get the inbox messages from my gmail 
account.but i can't.plzz help me.i got  "You have a nil object when you 
didn't expect it!
The error occurred while evaluating nil.connection= error".i got tis 
eror when i used g.messages line  in my code.my code is


require 'rubygems'
require 'gmailer'

class FirstController < ApplicationController


 def index
   count=0
   puts "lll"
   if GMailer.connect('myaccountgmail.com', 'password')
   puts "CONNECTED"
   begin
   GMailer.connect('myacco...@gmail.com', 'password') do |g|
   puts " enter"
   puts g.inspect
   g.messages(:label => "inbox") do |ml|
   ml.each_msg do |conversation|
 Email.create!(
 :title=> conversation.subject,
 :text => conversation.body,
 :sender   => conversation.sender,
 :sender_email => conversation.sender_email,
 :reply_email  => (conversation.reply_email.blank?) ?
conversation.sender_email : conversation.reply_email
 )
 count += 1
 puts conversation.archive
   end
  end
  end #connect
  rescue Exception => e
puts e
  end
   end
   count
 end


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

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



[Rails] Re: Optimize redundant code

2009-02-10 Thread Maurício Linhares

What you need is a custom form buider ->
http://onrails.org/articles/2008/06/13/advanced-rails-studio-custom-form-builder

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Tue, Feb 10, 2009 at 8:08 AM, atmorell  wrote:
>
> Hello,
>
> I would like to wrap the class type-text around each label/text_field.
> There must be a better way than my example below? I don't know how to
> do this without an object to loob through :)
>
> <% content_tag :div, :class => "type-text" do -%>
>  <%= label(:user, :login, "Username") %><%= f.text_field :login %>
> <% end %>
>
> <% content_tag :div, :class => "type-text" do -%>
>  <%= label(:user, :firstname, "Firstname") %><%=
> f.text_field :firstname %>
> <% end %>
>
> <% content_tag :div, :class => "type-text" do -%>
>  <%= label(:user, :lastname, "Lastname") %><%= f.text_field :lastname
> %>
> <% end %>
>
> Best regards.
> Asbjørn Morell.
> >
>

--~--~-~--~~~---~--~~
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 for London

2009-02-10 Thread Julian Leviston

Drop me a line.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

On 10/02/2009, at 9:27 PM, "jcb...@googlemail.com"  wrote:

>
> Help looking for someone to help out with a large prject at an agency
> j...@alan-morris.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: Constants not visible in controllers or models

2009-02-10 Thread Maurício Linhares

Where have you defined those constants?

Constants should be accessed with NameOfTheClass::NAME_OF_THE_CONSTANT

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Tue, Feb 10, 2009 at 9:09 AM, Peter Hickman  wrote:
>
> Hi,
>
> I might be being a bit thick today but I have a problem that I can't
> seem to shake.
>
> I have some configuration data in a yaml file that I load with an
> initializer.
>
> AVATARS_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/avatars.yml")
>
> The information includes where to save upload files and other stuff so
> it is needed in several places. One of the controllers can reference
> AVATARS_CONFIG, but the model, avatars.rb cannot. So I have to have
> the same line in any controller or model that needs it. Which looks to
> be very messy not to mention inconsistent - some places need it, other
> don't.
>
> I've tried to make them global, ie $AVATARS_CONFIG, but it doesn't
> seem to work.
>
> Anyone have any idea how I might get this and other constants I
> require to be available globally?
>
> Thanks
>
>
> >
>

--~--~-~--~~~---~--~~
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: WebOrb usage

2009-02-10 Thread Julian Leviston

Web orb is an object request broker, which means it sends objects ban  
and forth between flex and rails. Perhaps your flex app doesn't use  
any ruby objects yet?

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

On 10/02/2009, at 6:00 PM, Sarika Patil  wrote:

>
> Hi,
>
> I m newbie for flex and want it to be implemented with rails.
> I followed the steps given in flexiblerails but what i wanted to  
> know is
>
> What is the use of weborb ?
>
> Without installing weborb plugin also my flex project runs fine.
> So can any one tell me.
>
> Thanks
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

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



[Rails] rescue_from for NoMethodError

2009-02-10 Thread shahroon ali
Hi everyone,
I was just trying to catch some exceptions in my app,
for "Record Not Found" I used this
in my application.rb file
  rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
  rescue_from ActionController::NoMethodError, :with => :show_error

private

  def record_not_found
render :text => "404 Not Found", :status => 404
  end
  def show_error(exception)
render :text => exception.message;
  end


and was quite successful but for "NoMethodError" I am trying the same but It
isn't working at all. Can anybody help me?
Thanks in advance,
Shahroon

--~--~-~--~~~---~--~~
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] Constants not visible in controllers or models

2009-02-10 Thread Peter Hickman

Hi,

I might be being a bit thick today but I have a problem that I can't  
seem to shake.

I have some configuration data in a yaml file that I load with an  
initializer.

AVATARS_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/avatars.yml")

The information includes where to save upload files and other stuff so  
it is needed in several places. One of the controllers can reference  
AVATARS_CONFIG, but the model, avatars.rb cannot. So I have to have  
the same line in any controller or model that needs it. Which looks to  
be very messy not to mention inconsistent - some places need it, other  
don't.

I've tried to make them global, ie $AVATARS_CONFIG, but it doesn't  
seem to work.

Anyone have any idea how I might get this and other constants I  
require to be available globally?

Thanks


--~--~-~--~~~---~--~~
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] Suppressing log messages for an action

2009-02-10 Thread Adam

Hi all,

I have a rails app that regularly pings the server to check for
changes. The problem I'm having is that my "ping" action is printing
so much output to the log that it's swamping any useful data. Is there
a way to turn off the log for a specific action? Ideally I'd like it
to print to the log only if there's an error, but I'd be quite happy
to just turn off the log altogether for the ping action. I'm using the
default Rails logger.

Many thanks,
Adam
--~--~-~--~~~---~--~~
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: "reaper" is not picking up new changes to my application???

2009-02-10 Thread Greg Hauptmann
Still stuck on this.  I made sure I wasn't in the "current" directory when I
did the call to "reaper" and I still get the same result, i.e. whilst the
process restarts it does not restart with the latest application updates
(made available via the new application being put in a new "releases"
directory, and then capistrano change the sym link for "current" to this new
directory).

Question - Is a "reaper" restart action supposed to update an application?
That is, is the out-of-the box Capistrano command
"/u/apps/equity/current/script/process/reaper" really supposed to update any
changes to an application (via a "cap deploy")?


*** BEFORE CALLING REAPER 
[r...@home equity]# ps ax | grep -i ruby
12857 ?S  0:02 ruby
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails start -d
-a 0.0.0.0 -p 3001 -P
/u/apps/equity/releases/20090209112325/tmp/pids/dispatch.3001.pid
-e production -c /u/apps/equity/releases/20090209112325 -l
/u/apps/equity/releases/20090209112325/log/mongrel.log
13036 pts/1R+ 0:00 grep -i ruby
[r...@home equity]# cat current/tmp/pids/dispatch.3001.pid
12857[r...@home equity]# ls -l
total 2
lrwxrwxrwx   1 root root   38 Feb 10 21:10 current ->
/u/apps/equity/releases/20090210111005
drwxrwxr-x  24 root root 1024 Feb 10 21:10 releases
drwxrwxr-x   6 root root 1024 Feb  8 20:46 shared

*** CALL REAPER ***
[r...@home equity]# /u/apps/equity/current/script/process/reaper
Restarting 12857


*** AFTER CALLING REAPER ***
[r...@home equity]# ps ax | grep -i ruby
13043 ?S  0:02 ruby
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails start -d
-a 0.0.0.0 -p 3001 -P
/u/apps/equity/releases/20090209112325/tmp/pids/dispatch.3001.pid
-e production -c /u/apps/equity/releases/20090209112325 -l
/u/apps/equity/releases/20090209112325/log/mongrel.log
13048 pts/1R+ 0:00 grep -i ruby
[r...@home equity]# ls -l
total 2
lrwxrwxrwx   1 root root   38 Feb 10 21:10 current ->
/u/apps/equity/releases/20090210111005
drwxrwxr-x  24 root root 1024 Feb 10 21:10 releases
drwxrwxr-x   6 root root 1024 Feb  8 20:46 shared
[r...@home equity]# cat current/tmp/pids/dispatch.3001.pid
13043[r...@home equity]#
[r...@home equity]#


Regards
Greg


2009/2/9 Greg Hauptmann 

> I think I see what you're getting at - this is actually the result of
> running the out of the box capistrano script - here's the cap deploy output
> for example (I just wanted to make it simpler re my post)
> Macintosh-2:equity greg$ cap deploy -n
>   * executing `deploy'
>   * executing `deploy:update'
>  ** transaction: start
>   * executing `deploy:update_code'
> updating the cached checkout on all servers
> executing locally: "git ls-remote /Users/greg/source/equity/.git HEAD"
>   * executing "if [ -d /u/apps/equity/shared/cached-copy ]; then cd
> /u/apps/equity/shared/cached-copy && git fetch -q origin && git reset -q
> --hard 43f8b3df4d8f1f6358b803fbb41f38fcb1a9ddc4; else git clone -q
> g...@10.1.1.102:/Users/greg/source/equity/.git
> /u/apps/equity/shared/cached-copy && cd /u/apps/equity/shared/cached-copy &&
> git checkout -q -b deploy 43f8b3df4d8f1f6358b803fbb41f38fcb1a9ddc4; fi"
> copying the cached version to /u/apps/equity/releases/20090209085535
>   * executing "cp -RPp /u/apps/equity/shared/cached-copy
> /u/apps/equity/releases/20090209085535 && (echo
> 43f8b3df4d8f1f6358b803fbb41f38fcb1a9ddc4 >
> /u/apps/equity/releases/20090209085535/REVISION)"
>   * executing `deploy:finalize_update'
>   * executing "chmod -R g+w /u/apps/equity/releases/20090209085535"
>   * executing "rm -rf /u/apps/equity/releases/20090209085535/log
> /u/apps/equity/releases/20090209085535/public/system
> /u/apps/equity/releases/20090209085535/tmp/pids &&\\\n  mkdir -p
> /u/apps/equity/releases/20090209085535/public &&\\\n  mkdir -p
> /u/apps/equity/releases/20090209085535/tmp &&\\\n  ln -s
> /u/apps/equity/shared/log /u/apps/equity/releases/20090209085535/log &&\\\n
>  ln -s /u/apps/equity/shared/system
> /u/apps/equity/releases/20090209085535/public/system &&\\\n  ln -s
> /u/apps/equity/shared/pids /u/apps/equity/releases/20090209085535/tmp/pids"
>   * executing "find /u/apps/equity/releases/20090209085535/public/images
> /u/apps/equity/releases/20090209085535/public/stylesheets
> /u/apps/equity/releases/20090209085535/public/javascripts -exec touch -t
> 200902090855.35 {} ';'; true"
>   * executing `deploy:symlink'
>   * executing "rm -f /u/apps/equity/current && ln -s
> /u/apps/equity/releases/20090209085535 /u/apps/equity/current"
>  ** transaction: commit
>   * executing `deploy:restart'
>   * executing "/u/apps/equity/current/script/process/reaper"
> Macintosh-2:equity greg$
>
>
>
> 2009/2/9 MaD 
>
>
>> i really don't know about reaper (as i'm not using it), but i guess
>> your problem is with the symlink "current". you are calling reaper
>> from that directory (in  your example: /u/apps/equity/releases/
>> 20090209050120) and it does never leave it. as it seems you need to

[Rails] Re: Rails 2.3.0 - ActionController::AbstractRequest not being loaded

2009-02-10 Thread Frederick Cheung


On 10 Feb 2009, at 11:16, szimek wrote:

>
> Hi,
>
> I got a plugin that extends ActionController::AbstractRequest. After
> updating Rails from 2.2.2 to 2.3.0 I'm getting the following error:
>
> 'load_missing_constant': uninitialized constant
> ActionController::AbstractRequest (NameError)

There's also the fact that ActionController::AbstractRequest  no  
longer exists.

Fred
>
>
> I've already seen people having similar problems with i.e. TMail and
> Sweeper. I guess that some kind of lazy loading mechanism has been
> introduced, but how to fix this problem?
>
> Cheers,
> Szymek
> >


--~--~-~--~~~---~--~~
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] weird behaviour of a Web Service

2009-02-10 Thread Rey9999

Hello everyone,

I'm currently writing a Rails application which should expose some web
methods, which need to be called by a windows mobile application.
I've been able to successfully call some webmethods from the mobile
application, but only the methods returning simple types as strings,
numbers, arrays etc.

Now I need to expose a method which receives an ActiveRecord object.
In this case, I've witnessed a strange behaviour.
If I write my method this way:

def get_role(role_id)
 a = Role.find(role_id)
 return a
end

I get a "Cannot map Role to SOAP/OM" exception from the mobile
application. Googling this error has lead me to this page:
http://benrobb.com/2007/02/06/cannot-map-objtype-to-soapom/

so I rewrote the method as:

def get_role(role_id)
a = Role.find(role_id)
return Role.new(:description => "#{a.description}", ..[all the
attributes here])
end

but in this case, the mobile application gives me a "FormatException"
error.
I cannot understand why, even if I'm returning a Role object in both
cases, I get two different error messages!
Where or what am I doing wrong?

Thanks in advance!
Regards,
Rey

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