[Rails] Re: rspec test cannot be passed when render partial in layout

2009-02-12 Thread MaD

would be nice to know if your page renders correctly when you access
it with your browser. also post the code of the partial that's causing
the error and of course the error itself. what's respec's output?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Download Movie through link

2009-02-12 Thread Deepak Mahajan

MaD wrote:
 if i understand correctly you can click that link, choose the option
 'save as', download it to you hd and watch it. but you if you click
 the link and choose 'open', your video player opens but doesn't show
 any content. correct?
 
 if so i don't think it's a problem with your rails app, but with your
 operating system. because as i understand it, the file gets send
 correctly. maybe try another video-player. are you able to open other
 videos on the net (maybe upload one to a ftp and open it with your
 browser)?

Hi MaD,

Yes your understanding is correct as u mentioned in first.
But I am able to open other videos on the net.

I am a new I don't know why this link not prompt me(to download or 
open_with).
but when I make a link of stored file it prompt correctly. So I thought 
some problem in my code.

Please help 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] Re: rspec test cannot be passed when render partial in layout

2009-02-12 Thread zerogy

Thanks for your replying.
the page render correctly since i would visit it via browser, and it
works all right.
in fact, there is nothing special in my partial, i pasted it below:

_footer.html.erb:
div id=footer-wrap
  div id=footer
  div class=bottom-links
div class=bottom-nav
  ul
lia href=About Us/a/li
lia href=Privacy/a/li
lia href=Contact Us/a/li
lia href=Help/a/li
  /ul
/div
  /div
  /div
/div

and each error has same informationm which is wrong number of
arguments (3 for 1)

On Feb 12, 4:03 pm, MaD mayer.domi...@gmail.com wrote:
 would be nice to know if your page renders correctly when you access
 it with your browser. also post the code of the partial that's causing
 the error and of course the error itself. what's respec's output?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Download Movie through link

2009-02-12 Thread MaD

alright, then let's take a look at your code...
how does it work? do you store your files in a folder inside your
public-directory and filename points to that location? or do you store
your files inside your database? what exactly is Movie.file and
Movie.filename?

the following line throws me off (don't understand it):
  render :text = @movie.file

what could help is a look at send_file:
http://api.rubyonrails.org/classes/ActionController/Streaming.html#M000401

or even the improvement x_send_file:
  http://wiki.rubyonrails.org/rails/pages/HowtoSendFilesFast

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: rspec test cannot be passed when render partial in layout

2009-02-12 Thread MaD


 and each error has same informationm which is wrong number of
 arguments (3 for 1)
which method is called with 3 arguments instead of 1?
is there anymore information you can give us?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Column not in table (legacy database)

2009-02-12 Thread Peter De Berdt

On 12 Feb 2009, at 00:21, Pete wrote:

 class Employee  ActiveRecord::Base
  has_one :job

has_one :job, :foreign_key = shssn, :dependent = :destroy

  set_primary_key emssan
  def self.table_name() peis301 end
  def name
#{emfnam} #{emlnam}
  end
 end


 The question is: Why is Rails looking for a key called EMPLOYEE_ID
 when I set the primary key value to emssan?  How do I fix this?

You probably need to define the foreign key in the has_one  
relationship too.


Best regards

Peter De Berdt


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Download Movie through link

2009-02-12 Thread Hitesh Rawal

Deepak Mahajan wrote:
 MaD wrote:
 if i understand correctly you can click that link, choose the option
 'save as', download it to you hd and watch it. but you if you click
 the link and choose 'open', your video player opens but doesn't show
 any content. correct?
 
 if so i don't think it's a problem with your rails app, but with your
 operating system. because as i understand it, the file gets send
 correctly. maybe try another video-player. are you able to open other
 videos on the net (maybe upload one to a ftp and open it with your
 browser)?
 
 Hi MaD,
 
 Yes your understanding is correct as u mentioned in first.
 But I am able to open other videos on the net.
 
 I am a new I don't know why this link not prompt me(to download or 
 open_with).
 but when I make a link of stored file it prompt correctly. So I thought 
 some problem in my code.
 
 Please help me.
 
 Thanks

As i understand you want application popup on link to download. if yes ? 
then set content-type as application.

eg :  @headers['Content-Type'] = 'application/force-download'
-- 
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: rspec test cannot be passed when render partial in layout

2009-02-12 Thread zerogy

i just do not know which method is called with 3 arguments instead of
1, so i could not solve the problem.
and i pasted the relevant code below:
routes.rb:
...
map.resources :users, :member = { :suspend = :get, :unsuspend
= :get }

users_controller.rb:
...
  # render new.rhtml
  def new
@user = User.new
  end

users_controller_spec.rb:
   ...
  describe named routing do
before(:each) do
get :new
end
it should route new_user_path() to /users/new do
  new_user_path().should == /users/new
end
end

new.html.erb:
div class=page-title
h1Sign up as a new user/h1/div

% @user.password = @user.password_confirmation = nil %
div id=signup-area
  div class=left
  % if flash[:error] %
div id=error
  %= flash[:error] %
/div
  % end %
  % form_for :user, :url = users_path, :html = {:class =
'bigform'} do |f| -%
div class=textfields
  div class=clearfix%= label_tag 'login' %
  %= f.text_field :login, :class=text %%= error_message_on
user, login %/div

  div class=clearfix%= label_tag 'email' %
  %= f.text_field :email, :class=text %
  %= error_message_on user, email %/div

  div class=clearfix%= label_tag 'password' %
  %= f.password_field :password, :class=text %
  %= error_message_on user, password %/div

  div class=clearfix%= label_tag 'password_confirmation',
'Confirm Password' %
  %= f.password_field :password_confirmation, :class=text %
  %= error_message_on user, password_confirmation %/div
/div
div class=clearfix%= submit_tag 'Sign up' %/div
  % end -%
  /div
/div

The error is:
ActionView::TemplateError in 'UsersController named routing should
route new_user_path() to /users/new'
wrong number of arguments (3 for 1)


PS: my rails version is 2.2, is there any more information needed?

On Feb 12, 4:43 pm, MaD mayer.domi...@gmail.com wrote:
  and each error has same informationm which is wrong number of
  arguments (3 for 1)

 which method is called with 3 arguments instead of 1?
 is there anymore information you can give us?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: rspec test cannot be passed when render partial in layout

2009-02-12 Thread zerogy

thank you very much and  i am going to debug to find out the source
problem

On Feb 12, 5:27 pm, MaD mayer.domi...@gmail.com wrote:
 it's hard to say what wenbt wrong. most likely you forgot to put a
 closing bracket somewhere or sth similar. i'd try to set a debugger
 into that test and go through it step by step (or better 'next' by
 'next' *g*) until you can nail down which method fails.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: NoMethodError

2009-02-12 Thread MaD

obviously it starts here:
  app/controllers/sorts_controller.rb:76:in `destroy'

show us the code for that method.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: NoMethodError in User_photos#show

2009-02-12 Thread MaD

well, the error-message is pretty clear:
 The error occurred while evaluating nil.user
 2:   %= link_to #...@photo.user.username}'s Photos,

@photo seems to be nil. the reason for it can be found in your
controller (where show is defined).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] routes

2009-02-12 Thread bingo bob


I'm trying to figure this.

in my schools controller i want to do this


  # implement a create action to create just the review for the
School...
  def create_review_for_a_school

@review = Review.new
@school = School.find(params[:school_id])
@review = @school.reviews.build(params[:review])

if @review.save # The creation workeddo this

   flash[:notice] = 'Review was successfully updated.'
   format.html { redirect_to(@school) }
   # format.xml  { head :ok }

else # if it didnt save do this...
   format.html { render :action = show }
end

  end


as a result I think i need a route...something like this

map.connect '/schools/:school_id/reviews/new', :controller = 'schools',
:action = 'create_review_for_a_school'

and also my form submit button for creating a review - how should that
look ?

I guess like this...

% form_for [...@school, Review.new] do |f| %


--

But it's still going to the reviews new action I'd like it to go to the
def create_review_for_a_school action?


any tips?
-- 
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: Download Movie through link

2009-02-12 Thread Deepak Mahajan

Hitesh Rawal wrote:
 Deepak Mahajan wrote:
 MaD wrote:
 if i understand correctly you can click that link, choose the option
 'save as', download it to you hd and watch it. but you if you click
 the link and choose 'open', your video player opens but doesn't show
 any content. correct?
 
 if so i don't think it's a problem with your rails app, but with your
 operating system. because as i understand it, the file gets send
 correctly. maybe try another video-player. are you able to open other
 videos on the net (maybe upload one to a ftp and open it with your
 browser)?
 
 Hi MaD,
 
 Yes your understanding is correct as u mentioned in first.
 But I am able to open other videos on the net.
 
 I am a new I don't know why this link not prompt me(to download or 
 open_with).
 but when I make a link of stored file it prompt correctly. So I thought 
 some problem in my code.
 
 Please help me.
 
 Thanks
 
 As i understand you want application popup on link to download. if yes ? 
 then set content-type as application.
 
 eg :  @headers['Content-Type'] = 'application/force-download'

Thanks Hitesh and MaD,

I have changed the header content-type as 'application/force-download'.

and It works.
But when I click on open_with then It play movie on player as well as 
download also.
even I remove force-download then also It download when I select 
open_with.

can anybody have any idea?

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

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



[Rails] Re: file uploading using ajax

2009-02-12 Thread Mathieu Rousseau
pena que parece que só funciona com jQuery...

On Wed, Feb 11, 2009 at 7:05 PM, guyb guyboer...@googlemail.com wrote:


 Use LiveQuery then you don't need rjs and responds_to_parent


 http://rails-revlog.blogspot.com/2009/02/ajax-sort-of-file-upload-using.html

 Guy Boertje

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: setting up remote rails

2009-02-12 Thread Mathieu Rousseau
who did you start your ror server? which one are you using?

On Wed, Feb 11, 2009 at 6:48 PM, The Dro desaa...@gmail.com wrote:


 I've got a remote machine on my network which has Ubuntu as the OS. I
 run my testserver on it with all my current PHP sites. All I have to
 type on my main Vista Machine as the URL is http://testserver; and it
 takes me to the index page i've created with links to all my sites on
 that remote Ubuntu machine.

 My question is:
 I've setup RoR on that machine, but when I type testserver:3000 it
 wont access that page. On the machine itself, I am able to see my RoR
 project, but not on my main machine. I'm even able to SSH into the
 testserver to work on the project files. How do I go about setting
 that up?

 My second Question is, Where are the config files to tell RoR to use
 the MySQL database I currently have setup on the testserver that
 phpmyadmin is also using? I have edited the database.yml file to
 include the correct login information and the mysql adapter but it's
 still not connecting properly to the database. Is there a certain file
 I can setup the paths in for my MySQL db?

 thanks in advance for your assistance,
 -dro

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Number formatter

2009-02-12 Thread Michael Hasenstein

Gavin Kistner wrote:
 While ActionView in rails does have a helper for this, it requires you 
 to supply the number of decimal places. What follows is my own code (as 
 a Ramaze helper) that (by default) automatically determines the number 
 of decimal places based on the size of the answer.


I just found this thread an Rails' number_to_human_size does exactly 
what you want as far as I can see, so there is no need to write your own 
function it seems?

http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M001656
-- 
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: routes

2009-02-12 Thread Hitesh Rawal

bingo bob wrote:
 
 I'm trying to figure this.
 
 in my schools controller i want to do this
 
 result I think i need a route...something like this
 
 map.connect '/schools/:school_id/reviews/new', :controller = 'schools',
 :action = 'create_review_for_a_school'
 
 
 --
 
 But it's still going to the reviews new action I'd like it to go to the
 def create_review_for_a_school action?
 
 
 any tips?

Here you can find the way of routing, I think It help's you.

http://rdr.rubyforge.org/
-- 
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] Questions about Sassy, the recurring payment system

2009-02-12 Thread Zac Zheng

Hi Alex,

I read about your Sassy release on LRUG's mailing list sometime ago. Now
that I need to implement an ecommerce subscription system for a client,
I have been delving into your code.

I have a few questions if you don't mind answering. I thought I would
post on here for the benefit of others.

Where are you using Sassy and is it in a production environment?

Do you know of anybody using Sassy?

I enjoyed reading your code by the way. It's very well written. Also,
much thanks for releasing it:)

Regards,
Zac
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Rails 2.2, abstract_class, and associations

2009-02-12 Thread Frederick Cheung


On 11 Feb 2009, at 22:09, Jim wrote:

 Anyone have any ideas on either a better way to handle the attribute
 names, or where to start looking to figure out how to make this work?

Have you also overridden respond_to?

Fred
 Thanks,

 Jim Crate
 Que Viva, LLC


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: insert rails into php

2009-02-12 Thread Frederick Cheung


On 12 Feb 2009, at 04:43, Sniper Abandon wrote:


 Frederick Cheung wrote:
 On 11 Feb 2009, at 10:37, Sniper Abandon wrote:
 apache, nginx etc... can certainly forward the request to different
 places based on the url (and other things). Where things might get
 complicated is to what extent your php bits and your rails bits will
 need to share information

 Fred

 thx Fred

 i have one more problem
 i want to create subdomain for their profile url accordingly to
 user_name

 for example i have url (http://localhost:3000/)

 if any person login as user_name then his profile page url should be
 http://user_name.localhost:3000/

Well I'm not sure how you'd do it in development, but in the real  
world you can setup a wildcard dns entry. There's a railscast on  
handling subdomains if my memory is correct.

Fred


 any idea ?
 -- 
 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] WAP in Rails

2009-02-12 Thread king

Hi All,

I am linux system admin...currently we have web application in PHP.
Considering to have wap version of the same and looking to get it done
in rails. Can any one suggest for what it takes to get wap in rails.
Also links to tutorials and guides are appreciated.

Thank You
Kanthi

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Multiple associations with to_json

2009-02-12 Thread MiquelH

Hi,

I am facing the same problem and looks like the following construction
works:

booking..to_json(:include = {:booking_state = {}, :customer =
{include = :customer_phones}})

Not as clean and nice as the expected though:

booking..to_json(:include = [:booking_state, {:customer = {include
= :customer_phones}}])

So I thought better to share

Cheers

On Jan 21, 7:03 am, Calvin Ng rails-mailing-l...@andreas-s.net
wrote:
 Menator,

 Have you found a solution for this problem? I am continually running
 into this same error you stated above.  It happens whenever I have
 multiple associations that exist at the same level (let's call them
 siblings) with one of them requiring a hash either to further traverse
 down to get deeper associations with a nested :include or when needing
 to specify other options on one of the siblings to qualify one of the
 :methods, :only or :except options.

 Please advise if you have found a solution to this issue?
 --
 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: Trying to make this application RESTy

2009-02-12 Thread Krishna Sankar (ksankar)

I think there are two ways of looking at this:

a)  Set of Orders. Then 2) and 3) are nothing but edit on an order.
b)  Set of lines. Then 2) and 3) are index lines with a find clause
(for example find unassigned lines or find unrecorded lines) and then
edit on an individual line.

HTH.

Cheers
k/

|-Original Message-
|From: rubyonrails-talk@googlegroups.com [mailto:rubyonrails-
|t...@googlegroups.com] On Behalf Of Anthony
|Sent: Wednesday, February 11, 2009 3:02 PM
|To: Ruby on Rails: Talk
|Subject: [Rails] Trying to make this application RESTy
|
|
|Ok, here's the basic workflow:
|
|1) A user inputs an order for a customer.  This consists of several
|line items of equipment rental. (So, for example, 3 trucks at 7 am,
|7:30, and 8am for June 23). (Ok, this part is easy... a standard Order
|resource with the usual CRUD actions)
|
|2) A user (may be the same as #1, or may not) must fulfill the order,
|so he must be able to pull up a list of unassigned work (for a
|particular day, for example), see this work is still unassigned and
|assign 3 trucks to this job.  (This is where things get fuzzy.  Is
|this specialized index action on Order?  I don't think so because
|we're editing the orders, not just listing them.  Is this a separate
|resource?)
|
|3) A user (may be the same, may not) must later go back and fill out
|the hours the trucks actually worked, so they must first be able to
|pull up a list of all work which has been completed to date and see
|this work has been assigned but not yet recorded.  (Same problem... is
|this another resource, or another view on the resource in number 2?)
|
|

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: setting up remote rails

2009-02-12 Thread MaD

1
you might want to configure your apache (or whatever webserver you
use) to forward your mongrel on port 3000.
look for something like this (for your webserver and operation
system):
http://schwuk.com/articles/2006/06/13/hosting-rails-applications-with-mongrel-apache-2-mod_proxy-on-debian-stable

2
as long as your database.yml is configured correctly you only need to
make sure that you have sufficient rights to access that database. run
  mysql -uroot -ppassword
and adjust settings (e.g. create database, grant access for chosen
user,...)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Refactoring RJS

2009-02-12 Thread Frederick Cheung


On 12 Feb 2009, at 02:59, David wrote:


 Hi Fred, thanks so much for your response, that is exactly what I was
 looking for.  What do you mean by rjs can be a bit of a crutch?
I mean that you can torture yourself for a long time trying to  
convince rjs to do something whereas you could get it done quicker  
(and probably end up with nicer results) just be writing the JS. Sure  
you'll need to spend a bit of time getting familiar with javascript  
and prototype/jquery/whatever library you end up using but it will be  
worth it in the long run


  What
 do you mean by rewriting the whole thing as a js function.  You mean
 just something like resetVisibility() and then just reset both the
 end_drop and start_drop elements within the resetVisibility function?

replace the whole rjs block by a call to a function that looked  
something like


function do_it(element_to_slide, end_drop_element, start_drop_element){
   new Effect.SlideDown(element_to_slide, {
afterFinish: function(){
resetVisibility(end_drop_element);
resetVisibility(start_drop_element);
});
}

 Thanks for your help, Dave

 On Feb 11, 4:17 am, Frederick Cheung frederick.che...@gmail.com
 wrote:
 On 11 Feb 2009, at 10:41, David wrote:





 I have some RJS that could use some refactoring.  I use the function
 called with afterFinish twice and Im wondering what the best way to
 refactor is. This is all inline rjs in the controller mind you:

  page.visual_effect :slide_down, add_appt_#{params
 [:day]}, :afterFinish = function(){
$('end_drop_#{params[:day]}_#{params
 [:appt_counter]}').style.display = 'block';
$('end_drop_#{params[:day]}_#{params
 [:appt_counter]}').style.visibility = 'hidden';
$('start_drop_#{params[:day]}_#{params
 [:appt_counter]}').style.display = 'block';
$('start_drop_#{params[:day]}_#{params
 [:appt_counter]}').style.visibility = 'hidden';
  }

 Yummy :-). if you're using prototype you can replace

 $('end_drop_foo').style.display = 'block';
 $('end_drop_foo').style.visibility = 'hidden';

 with

 $('end_drop_foo').setStyle({display: 'block', visibility: 'hidden'})

 If i were you I'd have in my application.js a function like

 function resetVisibility(element){
element.setStyle({display: 'block', visibility: 'hidden'})

 }

 then then your rjs stuff looks like

 resetVisibility('end_drop_#{params[:day]}_#{params[:appt_counter]}')
 resetVisibility 
 ('start_drop_#{params[:day]}_#{params[:appt_counter]}')

 or even right the whole thing as a js function (RJS can be a bit of a
 crutch)

 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: bundle_fu making my app very slow

2009-02-12 Thread Mukund

Use Rails in-built caching instead.  If you want to use bundle_fu to
obfuscate your scripts, then you need to note that it will take a long
time the first time the server is run for doing the caching.
Subsequent requests will be faster.

Regards,
Mukund


On Feb 12, 11:25 am, zero0x zero0...@gmail.com wrote:
 Hi,

 I tried the bundle_fu plugin,

 and as of moving to production, I noticed, that my views render in
 70ms without bundle_fu, and about 1800ms with it!

 It's not always 1800 but most of the time.

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



[Rails] named_scope and having?

2009-02-12 Thread Gabriele Tassoni

Hi all,
is just my fault.. or I can't write an having caluse for a group in a
named scope? °_°

i.e.

named_scope :last_year_best_buyers, :joins = :invoices, :conditions
= {invoices.closed = true, invoices.issued_on =
1.years.ago..Date.today}, :group = customers.id, :having = SUM
(invoices.taxable_income)  15000

Calling Customer.last_year_best_buyers, leads to a:

ArgumentError: Unknown key(s): having

How can I specify an having clause (the only way I know to filter
results using aggregate functions, ain't it)?

thanks
G.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: named_scope and having?

2009-02-12 Thread Gabriele Tassoni

Well... I always can specify it on the group clause.. but it doesn't
look so clean to me (esp. since the find method has the having
clause... °_°)

named_scope :last_year_best_buyers, :joins = :invoices, :conditions
= {invoices.closed = true, invoices.issued_on =
1.years.ago..Date.today}, :group = customers.id HAVING SUM
(invoices.taxable_income)  15000

G.

On 12 Feb, 12:57, Gabriele Tassoni gabriele.tass...@gmail.com wrote:
 Hi all,
 is just my fault.. or I can't write an having caluse for a group in a
 named scope? °_°

 i.e.

 named_scope :last_year_best_buyers, :joins = :invoices, :conditions
 = {invoices.closed = true, invoices.issued_on =
 1.years.ago..Date.today}, :group = customers.id, :having = SUM
 (invoices.taxable_income)  15000

 Calling Customer.last_year_best_buyers, leads to a:

 ArgumentError: Unknown key(s): having

 How can I specify an having clause (the only way I know to filter
 results using aggregate functions, ain't it)?

 thanks
 G.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: named_scope and having?

2009-02-12 Thread MaD

are you running rails 2.3 or higher?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: named_scope and having?

2009-02-12 Thread Gabriele Tassoni

Another problem with having to specify the HAVING in the group key..
is that it looks like it would lead to errors when sequencing multiple
named_scopes, i.e.:

Customer.last_year_best_buyers.with_active_account

But I have to investigate more on this...

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



[Rails] Should I sleep here?

2009-02-12 Thread Gavin

Hi

I'm building an app at the moment where specific items can be added to
an order and then purchased through paypal.

Becuase the items are limited, it's important to relist them quickly
if the order is not completed within 5mins.

Anybody have any suggestions as to how I could go about this?

I was thinking of creating an observer for orders and including an
after_create like so:

Class OrderObserver  ActiveRecord::Observer

def after_create
  sleep 300 # sleep for 5 mins
  if self.status  3 # anything above 3 should be saved
return
  else
self.items.each do |item|
  item.update_attribute :order_id, nil
end
self.destroy
  end
end

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



[Rails] Re: Should I sleep here?

2009-02-12 Thread MaD

take a look at backgrounDRb. maybe this could be an option for you.
http://backgroundrb.rubyforge.org/

in a background process you could sleep for as long as you want to,
but if you try that in your main process your application might freeze
for that amount of time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Should I sleep here?

2009-02-12 Thread Gavin

I thought that may be the case
Thanks for your help - will read up on background DRb

On 12 Feb, 12:30, MaD mayer.domi...@gmail.com wrote:
 take a look at backgrounDRb. maybe this could be an option for 
 you.http://backgroundrb.rubyforge.org/

 in a background process you could sleep for as long as you want to,
 but if you try that in your main process your application might freeze
 for that amount of time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Pass variables inside the page

2009-02-12 Thread Enzo Rivello

Hi!

I need to create a combobox which , depending on the selected value,
will display different items whithout reloading the page

%= select(product,choice, Pricebooks.find(:all).collect { |p|
[p.name,p.id]}, {:selected = Pricebooks.find(:first)} , {onchange =
???)%

How can i retrieve the value of the selected product through onchange?

thanx in advance


enzo rivello
-- 
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] Common action for all the controllers.

2009-02-12 Thread Siddick Ebramsha

I am writing a small plugin for ruby on Rails. I faced a problem while
create a common action for all the controllers.  I found a solution for
it, But i am not satisfied with the solution.

The solution that I got is :-

ActionController::Base.class_eval do
  def common_action
render :text = hai
  end

  def action_init
  self.class.action_methods.add common_action
  end

  before_filter :action_init

end



If you have any alternate solution, please provide.
-- 
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] i18n with Rails 2.1

2009-02-12 Thread Jeba Momin

Hi.
I'm currently using Rails 2.1.
But i want to use i18n to internationalize my rails application.
I'm trying to install rails 2.2 using:
gem update rails
but it gives me an error...
Can anyone please suggest..how do I do this???
Thank 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: i18n with Rails 2.1

2009-02-12 Thread Mathieu Rousseau
Maybe a little more detail would help... OS? Error?

On Thu, Feb 12, 2009 at 10:56 AM, Jeba Momin 
rails-mailing-l...@andreas-s.net wrote:


 Hi.
 I'm currently using Rails 2.1.
 But i want to use i18n to internationalize my rails application.
 I'm trying to install rails 2.2 using:
 gem update rails
 but it gives me an error...
 Can anyone please suggest..how do I do this???
 Thank 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: i18n with Rails 2.1

2009-02-12 Thread Jeba Momin

Mathieu Rousseau wrote:
 Maybe a little more detail would help... OS? Error?
 
 On Thu, Feb 12, 2009 at 10:56 AM, Jeba Momin 

OS:windows XP
Error:
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response ( The request is not supported.  ) 500 
(http://gems.rubyforge.v
m.bytemark.co.uk/gems/rails-2.2.2.gem)
-- 
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: named_scope and having?

2009-02-12 Thread Gabriele Tassoni



On 12 Feb, 13:13, MaD mayer.domi...@gmail.com wrote:
 are you running rails 2.3 or higher?

no, I'm not, I'm using rails 2.2.2... (the current stable, I
believe...)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: i18n with Rails 2.1

2009-02-12 Thread Mathieu Rousseau
The urls it tries to download the gem from is not working...

I do not know anything about mirrors, hope someone else here knows...

On Thu, Feb 12, 2009 at 11:04 AM, Jeba Momin 
rails-mailing-l...@andreas-s.net wrote:


 Mathieu Rousseau wrote:
  Maybe a little more detail would help... OS? Error?
 
  On Thu, Feb 12, 2009 at 10:56 AM, Jeba Momin 

 OS:windows XP
 Error:
 ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response ( The request is not supported.  ) 500
 (http://gems.rubyforge.v
 m.bytemark.co.uk/gems/rails-2.2.2.gem)
 --
 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: i18n with Rails 2.1

2009-02-12 Thread MaD

try specifying the source:
  gem update rails --source=http://gems.rubyforge.org

other than that try to update your rubygems.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Should I sleep here?

2009-02-12 Thread Frederick Cheung


On 12 Feb 2009, at 12:32, Gavin wrote:


 I thought that may be the case
 Thanks for your help - will read up on background DRb

another possibility is to have a cron job or daemon that checks for  
orders that have been waiting for too long (stick a expires_at column  
or something on the table). Just calling sleep is a bad idea.

Fred
 On 12 Feb, 12:30, MaD mayer.domi...@gmail.com wrote:
 take a look at backgrounDRb. maybe this could be an option for 
 you.http://backgroundrb.rubyforge.org/

 in a background process you could sleep for as long as you want to,
 but if you try that in your main process your application might  
 freeze
 for that amount of time.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Pass variables inside the page

2009-02-12 Thread Frederick Cheung


On 12 Feb 2009, at 12:40, Enzo Rivello wrote:


 Hi!

 I need to create a combobox which , depending on the selected value,
 will display different items whithout reloading the page

 %= select(product,choice, Pricebooks.find(:all).collect { |p|
 [p.name,p.id]}, {:selected = Pricebooks.find(:first)} , {onchange =
 ???)%

 How can i retrieve the value of the selected product through onchange?

is this entirely client side or do you want to make an ajax request ?

Fred
 thanx in advance


 enzo rivello
 --  
 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: named_scope and having?

2009-02-12 Thread MaD

i may be wrongv but i think :having in scopes is new to rails 2.3

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Pass variables inside the page

2009-02-12 Thread Enzo Rivello

Frederick Cheung wrote:
 On 12 Feb 2009, at 12:40, Enzo Rivello wrote:
 
 How can i retrieve the value of the selected product through onchange?

 is this entirely client side or do you want to make an ajax request ?
 
 Fred

if possible only on client side
-- 
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: Pass variables inside the page

2009-02-12 Thread Mathieu Rousseau
That's pure JS then.

onChange(this), and treat it accordingly...


On Thu, Feb 12, 2009 at 11:17 AM, Enzo Rivello 
rails-mailing-l...@andreas-s.net wrote:


 Frederick Cheung wrote:
  On 12 Feb 2009, at 12:40, Enzo Rivello wrote:
 
  How can i retrieve the value of the selected product through onchange?
 
  is this entirely client side or do you want to make an ajax request ?
 
  Fred

 if possible only on client side
 --
 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: named_scope and having?

2009-02-12 Thread MaD

quote changelog:
*2.3.0/3.0*
* Add :having as a key to find and the relevant associations.
[miloops]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: i18n with Rails 2.1

2009-02-12 Thread Jeba Momin

MaD wrote:
 try specifying the source:
   gem update rails --source=http://gems.rubyforge.org
 
 other than that try to update your rubygems.

Hey..
Thank You so much...
that worked for me...
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] Re: Pass variables inside the page

2009-02-12 Thread Enzo Rivello

Mathieu Rousseau wrote:
 That's pure JS then.
 
 onChange(this), and treat it accordingly...
 
 
 On Thu, Feb 12, 2009 at 11:17 AM, Enzo Rivello 

and trough server side, how would it be?
-- 
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: Pass variables inside the page

2009-02-12 Thread Mathieu Rousseau
well, you can submit a classic form request and reload the whole page, or
submit an ajax request and then update just a part of your page. I think
that you should decide what you want do, then hack this solution. Not decide
what you want to do because it seems simpler to do.

On Thu, Feb 12, 2009 at 11:27 AM, Enzo Rivello 
rails-mailing-l...@andreas-s.net wrote:


 Mathieu Rousseau wrote:
  That's pure JS then.
 
  onChange(this), and treat it accordingly...
 
 
  On Thu, Feb 12, 2009 at 11:17 AM, Enzo Rivello 

 and trough server side, how would it be?
 --
 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: Opening file content into a textarea

2009-02-12 Thread elioncho

Many thanks MaD, I'll try it out.

On Feb 12, 2:55 am, MaD mayer.domi...@gmail.com wrote:
 in ruby there is the class File:http://www.ruby-doc.org/core/classes/File.html

 to get the contents of your file try something like:
   my_file = File.new(path_to_file, 'r')
   @my_file_content = my_file.read
   my_file.close

 now you can show your content inside the text area (you should know
 how to build a simple form for it).

 after editing it, back in your controller write the updated contents
 to the file:
   updated_content = params[:whatever]
   my_file = File.new(path_to_file, 'w')
   my_file.write(updated_content)
   my_file.close
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: insert rails into php

2009-02-12 Thread elioncho

Hey guys I’ll leave this two links here if you’re interested in
working with subdomains:

http://www.37signals.com/svn/posts/1512-how-to-do-basecamp-style-subdomains-in-rails
http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained


On Feb 11, 11:43 pm, Sniper Abandon rails-mailing-l...@andreas-s.net
wrote:
 Frederick Cheung wrote:
  On 11 Feb 2009, at 10:37, Sniper Abandon wrote:
  apache, nginx etc... can certainly forward the request to different
  places based on the url (and other things). Where things might get
  complicated is to what extent yourphpbits and yourrailsbits will
  need to share information

  Fred

 thx Fred

 i have one more problem
 i want to create subdomain for their profile url accordingly to
 user_name

 for example i have url (http://localhost:3000/)

 if any person login as user_name then his profile page url should 
 behttp://user_name.localhost:3000/

 any idea ?
 --
 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: named_scope and having?

2009-02-12 Thread Gabriele Tassoni



On 12 Feb, 14:18, MaD mayer.domi...@gmail.com wrote:
 quote changelog:
 *2.3.0/3.0*
 * Add :having as a key to find and the relevant associations.

Thank you.. ^_^ I was guessing about it since your first post.. now I
just hobe rail 2.3 won't brake too much things, it's never good to
have to switch framework version in the middle of an app development!
^_^

G.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Common action for all the controllers.

2009-02-12 Thread MaD

that's right, but you didn't mention you were trying to write a
plugin.
in that case try to write it like this:

# my_plugin.rb:
module MyPlugin
  def my_action
  end
end

# init.rb:
ActionController::Base.send :include, MyPlugin

hope i didn't forget anything.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Common action for all the controllers.

2009-02-12 Thread MaD

sorry, just checked it. i gotta be like this:

  # my_plugin.rb:
  module MyPlugin
def self.included(base)
  base.extend(ClassMethods)
end

module ClassMethods
  def my_action
# ...
  end
end
  end

irb(MyOtherController):001:0 MyOtherController.methods.include?
('my_action')
= true

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: ROXML from_xml not returning an object instance...

2009-02-12 Thread Ben Woosley

Alright, I found that this actually required a bit more to work
properly, but if you look at my latest code: 
http://github.com/Empact/roxml/tree/master,
I have a examples/active_record.rb, and spec/examples/active_record.rb
to show it's working properly.

So install this latest version from my github and you should have
things working.  See the history:
http://github.com/Empact/roxml/blob/a2434d5c14a31ec2099c38a6248b4fcf4e5f5565/History.txt
for the changes involved.

You should also get some deprecation warnings from this newest code.
I'm preparing for a bit of an API shakeup in 3.0 which should be the
last.  In short, all type declaration come via the :as parameter, all
location declarations come via :from and :in, all options come as
separate arguments.  The rdocs should be up to date on this.

On Feb 5, 1:42 am, Ben Woosley ben.woos...@gmail.com wrote:
 Alright, the problem seems to be thatROXMLuses the Object#allocate
 to generate objects, and never calls #initialize on those objects,
 owing to the fact that you would want to initialize differently in a
 world where your attributes are already initialized than in one where
 they are not (which is the base #new case).  There's a workaround
 though, which I haven't tested but which will definitely solve the
 immediate problem.  That is to implement the #xml_initialize method on
 your objects, and in it, call the regular #initialize, like so:

 class RoxmlClass  ActiveRecord::Base
   includeROXML
   def self.xml_initialize
     initialize
   end
 end

 #xml_initialize (http://roxml.rubyforge.org/rdoc/classes/ROXML/
 InstanceMethods/Construction.html#M10) is called at the end of
 #from_xml, and can be used to do things like call initialize with the
 data from your xml attributes, or whatever else.

 Hope that helps, and I'll have something which handles this in a
 general way out in the near future.  Feel free to contact me directly
 in the future.  You'll find my email on the 
 website:http://empact.github.com/roxml/

 On Feb 4, 9:33 am, Ben Woosley rails-mailing-l...@andreas-s.net
 wrote:

  Hey Adam,

  I'll take a look at this later today and get back to you.  I
  specifically haven't tested intermixingROXMland ActiveRecord (as you
  have with :waypoints).  I suspect the problem is that I'm setting the
  instance variable rather than going through the proxy accessor.  I'll
  post here again when I have that worked out.

  Or, if you're so inclined, you can dig into the code yourself.  See the
  instance_variable_set line, line 586 
  here:http://github.com/Empact/roxml/blob/c9a3d82827d6939fcc76fa354a52f8bc3...
  --
  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: Common action for all the controllers.

2009-02-12 Thread Ar Chron

 If you have any alternate solution, please provide.

I didn't go the plugin route in our application, but opted for a form of 
behavior by convention

class GenericController  ApplicationController
  # here's the standard index method
  def index
blah blah blah
  end

  # here's a new common method for all controllers
  def common_action
moo moo moo
  end
end

class Project  GenericController
  # inherits the common_action action

  # and if need be (if Project truly needs behavior different from
  # the 'standard' we have for our app
  def index
# non-standard behavior for this class
blah blah blah
  end
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] Auto Complete

2009-02-12 Thread Miguel Regedor

What I'm trying to do:
I want to create an auto completed field for locations, but didn't
want to have the locations stored in my app. My idea is to somehow use
Google to fill that auto complete text field and then retrieve chords
using gmaps geocoding. Have anyone done something like this? does
Google was some api to do something like that? You think there is any
chance of doing this, without storing a list of locations in my db??
and which do you think is the best plugin for auto complete. Thanks in
advanced every one
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Should I sleep here?

2009-02-12 Thread Robert Walker

Gavin wrote:
 Anybody have any suggestions as to how I could go about this?
 
 I was thinking of creating an observer for orders and including an
 after_create like so:
 
 Class OrderObserver  ActiveRecord::Observer
 
 def after_create
   sleep 300 # sleep for 5 mins
   if self.status  3 # anything above 3 should be saved
 return
   else
 self.items.each do |item|
   item.update_attribute :order_id, nil
 end
 self.destroy
   end
 end

Sorry if this response is a bit off the question's topic, but I do have 
an unrelated suggestion.

You have the following line in your sample code:
   if self.status  3 # anything above 3 should be saved

I would recommend against this use of magic numbers, such as 3 in 
this case. The number 3 has no meaning here. I would recommend that you 
use something like a finite state machine.

http://en.wikipedia.org/wiki/Finite_state_machine

There is a Ruby gem implementation of this:
http://github.com/rubyist/aasm/tree/master

Now the same line of code can be written as:
if self.completed?

Now there is no ambiguity on the meaning of some magic number. The 
code clearly states its intent.
-- 
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: Should I sleep here?

2009-02-12 Thread Gavin

So, would it be more appropriate to write a method like

def purchased?
  if self.status  3
return true
  else
return false
  end
end

and then call the purchased? method to perform the check?



On 12 Feb, 14:39, Robert Walker rails-mailing-l...@andreas-s.net
wrote:
 Gavin wrote:
  Anybody have any suggestions as to how I could go about this?

  I was thinking of creating an observer for orders and including an
  after_create like so:

  Class OrderObserver  ActiveRecord::Observer

  def after_create
    sleep 300 # sleep for 5 mins
    if self.status  3 # anything above 3 should be saved
      return
    else
      self.items.each do |item|
        item.update_attribute :order_id, nil
      end
      self.destroy
    end
  end

 Sorry if this response is a bit off the question's topic, but I do have
 an unrelated suggestion.

 You have the following line in your sample code:

    if self.status  3 # anything above 3 should be saved

 I would recommend against this use of magic numbers, such as 3 in
 this case. The number 3 has no meaning here. I would recommend that you
 use something like a finite state machine.

 http://en.wikipedia.org/wiki/Finite_state_machine

 There is a Ruby gem implementation of 
 this:http://github.com/rubyist/aasm/tree/master

 Now the same line of code can be written as:
 if self.completed?

 Now there is no ambiguity on the meaning of some magic number. The
 code clearly states its intent.
 --
 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] acts_as_list sort by multiple items

2009-02-12 Thread Tod Mcintyre

I have a Person model and I'm using acts_as_list so I can have drag/drop
positioning of people.  The only thing is, I want to be able to
differentiate between male and female, ie. sort males separately from
females.  It seems completely useless to have two separate models since
all the other attributes of a person are the same (name, address etc)
Does acts_as_list allow ordering by, say, position and sex?

In writing this, I also just thought, maybe I can create a person model
and have a male/female model extend from this with attribute sex, then
use acts_as_list on the male/female model.  I'm not sure i would know
how to design the db for that.

Any thoughts on this?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: cPanel Ruby Gems

2009-02-12 Thread Michael Mike

Did you find a solution to this? I am experiencing the same problem.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Should I sleep here?

2009-02-12 Thread Robert Walker

Gavin wrote:
 So, would it be more appropriate to write a method like
 
 def purchased?
   if self.status  3
 return true
   else
 return false
   end
 end
 
 and then call the purchased? method to perform the check?
 
 
 
 On 12 Feb, 14:39, Robert Walker rails-mailing-l...@andreas-s.net

Actually it could be as simple as adding some constants to represent 
your states.

Example:
STARTED = 1
PROCESSING = 2
COMPLETED = 3
BILLED = 4
PAID = 5

if self.state  COMPLETED

You just want to avoid the use of a magic number by giving it clear 
meaning.

-- 
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: Should I sleep here?

2009-02-12 Thread Gavin

Writing more unit tests for this as we speak

Thanks for the tip Robert

PS - I presume, if I were to use constants that I would define the
constants in the class itself?

On 12 Feb, 15:17, Robert Walker rails-mailing-l...@andreas-s.net
wrote:
 Gavin wrote:
  So, would it be more appropriate to write a method like

  def purchased?
    if self.status  3
      return true
    else
      return false
    end
  end

  and then call the purchased? method to perform the check?

  On 12 Feb, 14:39, Robert Walker rails-mailing-l...@andreas-s.net

 Actually it could be as simple as adding some constants to represent
 your states.

 Example:
 STARTED = 1
 PROCESSING = 2
 COMPLETED = 3
 BILLED = 4
 PAID = 5

 if self.state  COMPLETED

 You just want to avoid the use of a magic number by giving it clear
 meaning.

 --
 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: Rails 2.2, abstract_class, and associations

2009-02-12 Thread Jim



On Feb 12, 6:11 am, Frederick Cheung frederick.che...@gmail.com
wrote:

 Have you also overridden respond_to?

No, I haven't.  But I'm curious what I would do with respond_to? that
would affect method_missing?

Jim


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Auto Complete

2009-02-12 Thread Robert Walker

Miguel Regedor wrote:
 What I'm trying to do:
 I want to create an auto completed field for locations, but didn't
 want to have the locations stored in my app. My idea is to somehow use
 Google to fill that auto complete text field and then retrieve chords
 using gmaps geocoding. Have anyone done something like this? does
 Google was some api to do something like that? You think there is any
 chance of doing this, without storing a list of locations in my db??
 and which do you think is the best plugin for auto complete. Thanks in
 advanced every one

The Ajax.Autocompleter would definitely work for your auto-complete text 
field so that's not an issue. What will be the challenge in your case 
will be the server-side action that builds the unordered list that will 
contain the locations.

http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter

All that's expected from the server-side action is that it returns an 
unordered list. How you build that is up to you. What might be tricky in 
your case is getting decent performance.

What do you mean by locations? The Earth has effectively infinite 
locations. And even if you talking about named locations, in the sense 
they can be searched for in Google Maps, the number of them is extremely 
large. If you're expecting that when the user type A every location 
from Google Maps that start with A gets returned in a list, I don't 
think you'll find that. I could be wrong, but I think that if it was 
that simple Google Maps would provide that sort of auto-completion.
-- 
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] Logging all exceptions

2009-02-12 Thread koopmann.lenn...@googlemail.com

Hey everyody,

what is the best way to log _all_ exceptions that are thrown in my
Rails application into a database table? I need some kind of hook in
the Rails exception methods?!

I already tried the Exception Logger plugin but that is not what I
want.

I just want to log _all_ exceptions into a database table without
needing to call own methods everywhere I expect an exception.

Thank you!
Lennart

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



[Rails] Help for ActionMailer!

2009-02-12 Thread klaus.kohlbauer

Hello,

I have a big problem und hoping for your help.

In my application a user should be able to edit an email template file
for himself and send it out e.g. to a customer. (thats the plan).

For that I have created some functionality to edit the template file
and an ActionMailer class with a method called 'createMail'. The user
is editing the template file, saves the file and then he is sending
the mail to the customer. Thats working fine. But now the user is
making changes on the template file and he wants to send it out
again.  And now my problem comes up. The result of createMail() is the
same as it was for the first time. The changes, the user has made in
the template file are not in the created email.

I think that has something to do with caching. Because all is working
well in the development environment but not in production.

Is there anyone who can help. Is there a possibility to force the
system to use the newer version of the template file and not to be
'proud' of an old file.

If I can get any help you will get an invitation to the octoberfest in
munich/bavaria/germany later this year :)

Best regards
Klaus Kohlbauer

infosense gmbh
Infanteriestrasse 19/5
80797 München
Telefon Büro: +49 89 12 11 35 59
Telefon Mobil: +49 173 999 777 9
Email: klaus.kohlba...@infosense.de
Web: www.infosense.de


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Help for ActionMailer!

2009-02-12 Thread Frederick Cheung



On Feb 12, 3:18 pm, klaus.kohlbauer klaus.kohlba...@infosense.de
wrote:
 Hello,

 I have a big problem und hoping for your help.

 In my application a user should be able to edit an email template file
 for himself and send it out e.g. to a customer. (thats the plan).

 For that I have created some functionality to edit the template file
 and an ActionMailer class with a method called 'createMail'. The user
 is editing the template file, saves the file and then he is sending
 the mail to the customer. Thats working fine. But now the user is
 making changes on the template file and he wants to send it out
 again.  And now my problem comes up. The result of createMail() is the
 same as it was for the first time. The changes, the user has made in
 the template file are not in the created email.

 I think that has something to do with caching. Because all is working
 well in the development environment but not in production.

You might be interested in 
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/1119127159435e5c
They're talking about actioncontroller views rather than actionmailer
views but it's all the same really.

What I've done in the past is just sidestep this completely with a
mailer method like this:

  def standard_email(recipient, template)
setup_common(recipient)
@subject = template.subject
@body = Liquid::Template.parse(template.body).render({})
  end

template is an activerecord object holding the body, subject etc. of
the message. I happened to use Liquid to render the message, but
that's up to you. You could read templates from disk rather than from
database.

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: named_scope and having?

2009-02-12 Thread Gabriele Tassoni

H! Even worse... named_scopes completely skip the :order key if
there's a HAVING clause.. °_° I thought I could have used wht I
proposed at 13:00, but the named scope didn't used the group key at
all to find the resultset... sic...
Quite annoying, I'm really hoping 2.3 won't break too much
compatibility with 2.2.2 code..

On 12 Feb, 14:45, Gabriele Tassoni gabriele.tass...@gmail.com wrote:
 On 12 Feb, 14:18, MaD mayer.domi...@gmail.com wrote:

  quote changelog:
  *2.3.0/3.0*
  * Add :having as a key to find and the relevant associations.

 Thank you.. ^_^ I was guessing about it since your first post.. now I
 just hobe rail 2.3 won't brake too much things, it's never good to
 have to switch framework version in the middle of an app development!
 ^_^

 G.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: named_scope and having?

2009-02-12 Thread Gabriele Tassoni



On 12 Feb, 17:08, Gabriele Tassoni gabriele.tass...@gmail.com wrote:
 H! Even worse... named_scopes completely skip the :order key if

Obviously referencing the :group key, not the :order one...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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::RoutingError in Products#index

2009-02-12 Thread Ashok Bee

Thomas r. Koll wrote:
 Hi Ashok,
 
 id's are always integer. I'm quite sure it's the same with an Oracle
 DB.
 So please fix you database and retry.
 
 ciao, tom
 
 On Feb 11, 6:19�pm, Ashok Bee rails-mailing-l...@andreas-s.net
 wrote:
 create table products (
 id number not null,
 ...
 primary key(id)
 )
 
 --
 Thomas R. TomK32 Koll  http://ananasblau.com
 just a geek trying to change the world
 http://github.com/TomK32

Thanks Thomas.
Have corrected my table create statement.
When I create a table and corresponding sequence manually, why scaffold 
script does not create the views with proper table fields in it?
When I do
C:\Documents and Settings\xyz\Desktop\ruby\web\abruby script\generate 
scaffo
ld address first_name:string last_name:string address:string 
phone:integer email
 this , it creates the views well.
Do I need to give the script a hint regarding the tables fields ?
-- 
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: Pass variables inside the page

2009-02-12 Thread Enzo Rivello

Mathieu Rousseau wrote:
 well, you can submit a classic form request and reload the whole page, 
 or
 submit an ajax request and then update just a part of your page. I think
 that you should decide what you want do, then hack this solution. Not 
 decide
 what you want to do because it seems simpler to do.
 
 On Thu, Feb 12, 2009 at 11:27 AM, Enzo Rivello 

thanx a lot i resolved the problem with a classic form!
thank 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: routes

2009-02-12 Thread bingo bob


Anyone provide any insight?

-- 
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] Easy RoR - Javascript syntax question

2009-02-12 Thread Tom Ha

Hi there,

a simple n00b question:

I have that Javascript snippet on my page (see below; taken from jquery,
actually).

I want to pass it the @cities array from the controller. But what's
the correct syntax, here?

See the 3rd line:



script
  $(document).ready(function(){
var data = @cities;    that's not correct, is it?
$(#city).autocomplete(data);
  });
/script



Thanks a lot for helping me!

Tom
-- 
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: Trying to make this application RESTy

2009-02-12 Thread Anthony

But that's kind of the problem... I don't want to edit lines one at a
time.  I want a batch edit.

On Feb 11, 11:04 pm, Krishna Sankar (ksankar) ksan...@cisco.com
wrote:
 I think there are two ways of looking at this:

 a)      Set of Orders. Then 2) and 3) are nothing but edit on an order.
 b)      Set of lines. Then 2) and 3) are index lines with a find clause
 (for example find unassigned lines or find unrecorded lines) and then
 edit on an individual line.

 HTH.

 Cheers
 k/

 |-Original Message-

 |From: rubyonrails-talk@googlegroups.com [mailto:rubyonrails-
 |t...@googlegroups.com] On Behalf Of Anthony
 |Sent: Wednesday, February 11, 2009 3:02 PM
 |To: Ruby on Rails: Talk
 |Subject: [Rails] Trying to make this application RESTy
 |
 |
 |Ok, here's the basic workflow:
 |
 |1) A user inputs an order for a customer.  This consists of several
 |line items of equipment rental. (So, for example, 3 trucks at 7 am,
 |7:30, and 8am for June 23). (Ok, this part is easy... a standard Order
 |resource with the usual CRUD actions)
 |
 |2) A user (may be the same as #1, or may not) must fulfill the order,
 |so he must be able to pull up a list of unassigned work (for a
 |particular day, for example), see this work is still unassigned and
 |assign 3 trucks to this job.  (This is where things get fuzzy.  Is
 |this specialized index action on Order?  I don't think so because
 |we're editing the orders, not just listing them.  Is this a separate
 |resource?)
 |
 |3) A user (may be the same, may not) must later go back and fill out
 |the hours the trucks actually worked, so they must first be able to
 |pull up a list of all work which has been completed to date and see
 |this work has been assigned but not yet recorded.  (Same problem... is
 |this another resource, or another view on the resource in number 2?)
 |
 |
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Should I sleep here?

2009-02-12 Thread Chris Kottom
+1 for implementing this as a cron job.  Sometimes the cleanest solution is
outside the framework.

On Thu, Feb 12, 2009 at 4:20 PM, Gavin ga...@thinkersplayground.com wrote:


 Writing more unit tests for this as we speak

 Thanks for the tip Robert

 PS - I presume, if I were to use constants that I would define the
 constants in the class itself?

 On 12 Feb, 15:17, Robert Walker 
 rails-mailing-l...@andreas-s.nethttps://mail.google.com/mail?view=cmtf=0to=rails-mailing-l...@andreas-s.net
 
 wrote:
  Gavin wrote:
   So, would it be more appropriate to write a method like
 
   def purchased?
 if self.status  3
   return true
 else
   return false
 end
   end
 
   and then call the purchased? method to perform the check?
 
   On 12 Feb, 14:39, Robert Walker 
   rails-mailing-l...@andreas-s.nethttps://mail.google.com/mail?view=cmtf=0to=rails-mailing-l...@andreas-s.net
 
 
  Actually it could be as simple as adding some constants to represent
  your states.
 
  Example:
  STARTED = 1
  PROCESSING = 2
  COMPLETED = 3
  BILLED = 4
  PAID = 5
 
  if self.state  COMPLETED
 
  You just want to avoid the use of a magic number by giving it clear
  meaning.
 
  --
  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: rake aborted! undefined method `each' for #Mysql:

2009-02-12 Thread Madhav Avd

The last suggestion that recommended downloadling libmysql.dll worked 
for me.
Thanks!

bflo...@westpac.com.au wrote:
 The problem is that libmysql.dll shipped with Mysql doesn't play well
 with ruby 2.2..
 
 The solution is to download the libmysql.dll from:
 
 http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll
 
 and save this in your ruby bin directory
 
 see also: 
 http://forums.aptana.com/viewtopic.php?f=20t=7563p=27407hilit=libmysql.dll#p27407
 
 
 
 On Dec 1 2008, 5:22�am, David Franklin rails-mailing-l...@andreas-

-- 
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: Should I sleep here?

2009-02-12 Thread Gavin

Am I right in saying Daemons for frequent tasks (performing a specific
check every minute or so) and cron jobs for less regular tasks
(cleaning up sessions every week or so)?

Are Daemons resource-intensive?


On 12 Feb, 18:27, Chris Kottom chris.kot...@gmail.com wrote:
 +1 for implementing this as a cron job.  Sometimes the cleanest solution is
 outside the framework.

 On Thu, Feb 12, 2009 at 4:20 PM, Gavin ga...@thinkersplayground.com wrote:

  Writing more unit tests for this as we speak

  Thanks for the tip Robert

  PS - I presume, if I were to use constants that I would define the
  constants in the class itself?

  On 12 Feb, 15:17, Robert Walker 
  rails-mailing-l...@andreas-s.nethttps://mail.google.com/mail?view=cmtf=0to=rails-mailing-l...@andreas-s.net

  wrote:
   Gavin wrote:
So, would it be more appropriate to write a method like

def purchased?
  if self.status  3
    return true
  else
    return false
  end
end

and then call the purchased? method to perform the check?

On 12 Feb, 14:39, Robert Walker 
rails-mailing-l...@andreas-s.nethttps://mail.google.com/mail?view=cmtf=0to=rails-mailing-l...@andreas-s.net

   Actually it could be as simple as adding some constants to represent
   your states.

   Example:
   STARTED = 1
   PROCESSING = 2
   COMPLETED = 3
   BILLED = 4
   PAID = 5

   if self.state  COMPLETED

   You just want to avoid the use of a magic number by giving it clear
   meaning.

   --
   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: Rails 2.2, abstract_class, and associations

2009-02-12 Thread Jim

On Feb 12, 6:11 am, Frederick Cheung frederick.che...@gmail.com
wrote:

 Have you also overridden respond_to?

I played around with overriding respond_to?, and figured out how to
make this all work.  Apparently, in Rails 2.2, if respond_to? returns
false, method_missing gets called on the association proxy instead of
the base class.  Although, I have to wonder if there's a better way to
accomplish this than through method_missing.  Maybe there's some way
to loop through all attributes and call alias_attribute dynamically
when classes are loaded?

Anyway, thanks for the help.

Jim


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



[Rails] Rails unixODBC

2009-02-12 Thread andypflueger

Hello,

I decided to embrace getting a new Rails application to see an
existing MSSQL database and trying to get unixODBC, freeTDS, and
ActiveRecord able to query my MSSQL database.

I'm following the procedure outlined at
http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServerFromRailsOnLinux
but my system (Ubuntu 8.10 - Intrepid Ibex, Rails 2.3, Ruby 1.8.7)
isn't cooperating.

I get as far as able to use 'sqsh' to test the server-side connection
and able to run SQL, but 'isql' or the IRB aren't able to access my
unixODBC DSN.

My /etc/odbc.ini:
[Server1]
Driver  = FreeTDS
Description = SQLServer Database
Trace   = No
Server  = ip_of_server
Port= 1433
Database= DB_Name

My /etc/odbcinst.ini:
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver  = /usr/lib/odbc/libtdsodbc.so
Setup   = /usr/lib/odbc/libtdsS.so
CPTimeout   =
CPReuse =
UsageCount  = 2

My /usr/lib/odbc directory:
total 680
-rw-r--r-- 1 root root   9516 2008-09-01 03:14 libesoobS.so
-rw-r--r-- 1 root root   5360 2008-09-01 03:14 libmimerS.so
-rw-r--r-- 1 root root  67604 2008-09-01 03:14 libnn.so
-rw-r--r-- 1 root root   5336 2008-09-01 03:14 libodbcdrvcfg1S.so
-rw-r--r-- 1 root root   5328 2008-09-01 03:14 libodbcdrvcfg2S.so
-rw-r--r-- 1 root root   5388 2008-09-01 03:14 libodbcminiS.so
-rw-r--r-- 1 root root   9440 2008-09-01 03:14 libodbcmyS.so
-rw-r--r-- 1 root root   5332 2008-09-01 03:14 libodbcnnS.so
-rw-r--r-- 1 root root   5424 2008-09-01 03:14 libodbcpsqlS.so
-rw-r--r-- 1 root root 148972 2008-09-01 03:14 libodbctxt.so
-rw-r--r-- 1 root root   5352 2008-09-01 03:14 libodbctxtS.so
-rw-r--r-- 1 root root   9720 2008-09-01 03:14 liboplodbcS.so
-rw-r--r-- 1 root root   5332 2008-09-01 03:14 liboraodbcS.so
-rw-r--r-- 1 root root   5332 2008-09-01 03:14 libsapdbS.so
-rw-r--r-- 1 root root 341668 2008-08-01 18:28 libtdsodbc.so
-rw-r--r-- 1 root root   5320 2008-09-01 03:14 libtdsS.so

Output from IRB test:
irb(main):001:0 require dbi
= true
irb(main):002:0 dbh = DBI.connect('dbi:ODBC:ivyweblv', 'railsuser',
'Pa$$w0rd')
DBI::DatabaseError: S1000 (0) [unixODBC][FreeTDS][SQL Server]Unable to
connect to data source
from /usr/local/lib/site_ruby/1.8/DBD/ODBC/ODBC.rb:95:in
`connect'
from /usr/local/lib/site_ruby/1.8/dbi/dbi.rb:584:in `connect'
from /usr/local/lib/site_ruby/1.8/dbi/dbi.rb:384:in `connect'
from (irb):2
from :0

Output from isql test:
[ISQL]ERROR: Could not SQLConnect

I followed the troubleshooting section in the above RubyOnRails Wiki
page, but am not able to get unixODBC to see the freeTDS driver it
seems.

Thanks in advance,
Andy Pflueger
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Reset password facility

2009-02-12 Thread Sazima

Lovd does just that, take a look at:

lovdbyless.com

http://github.com/stevenbristol/lovd-by-less/tree/master

Cheers, Sazima

On Feb 11, 7:35 pm, Shockmeister b00020...@student.itb.ie wrote:
 I have used a sha256 hashing algorithm in order to provide some
 security to my login facility. I now want to create a facility
 whereby, if the user forgets their password, they are emailed a
 temporary password so that they can login. Has anyone had any
 experience implementing this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Should I sleep here?

2009-02-12 Thread Sazima

Hi,

Check out this excelent railscast:

http://railscasts.com/episodes/129-custom-daemon

It is really easy  effective.

Also, Thorny Gorms has some built-in checks for form expiration:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/9ec5a5112548c95e

Cheers, Sazima

On Feb 12, 4:35 pm, Gavin ga...@thinkersplayground.com wrote:
 Am I right in saying Daemons for frequent tasks (performing a specific
 check every minute or so) and cron jobs for less regular tasks
 (cleaning up sessions every week or so)?

 Are Daemons resource-intensive?

 On 12 Feb, 18:27, Chris Kottom chris.kot...@gmail.com wrote:

  +1 for implementing this as a cron job.  Sometimes the cleanest solution is
  outside the framework.

  On Thu, Feb 12, 2009 at 4:20 PM, Gavin ga...@thinkersplayground.com wrote:

   Writing more unit tests for this as we speak

   Thanks for the tip Robert

   PS - I presume, if I were to use constants that I would define the
   constants in the class itself?

   On 12 Feb, 15:17, Robert Walker 
   rails-mailing-l...@andreas-s.nethttps://mail.google.com/mail?view=cmtf=0to=rails-mailing-l...@andreas-s.net

   wrote:
Gavin wrote:
 So, would it be more appropriate to write a method like

 def purchased?
   if self.status  3
     return true
   else
     return false
   end
 end

 and then call the purchased? method to perform the check?

 On 12 Feb, 14:39, Robert Walker 
 rails-mailing-l...@andreas-s.nethttps://mail.google.com/mail?view=cmtf=0to=rails-mailing-l...@andreas-s.net

Actually it could be as simple as adding some constants to represent
your states.

Example:
STARTED = 1
PROCESSING = 2
COMPLETED = 3
BILLED = 4
PAID = 5

if self.state  COMPLETED

You just want to avoid the use of a magic number by giving it clear
meaning.

--
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: Should I sleep here?

2009-02-12 Thread Gavin

Thanks Sazima - I set up a daemon like this earlier today and it's
working a treat, just wasn't sure if this was the most economic way to
get the job done!

But if it's good enough for Ryan, it's good enough for me.



On 12 Feb, 19:33, Sazima rsaz...@gmail.com wrote:
 Hi,

 Check out this excelent railscast:

 http://railscasts.com/episodes/129-custom-daemon

 It is really easy  effective.

 Also, Thorny Gorms has some built-in checks for form expiration:

 http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/...

 Cheers, Sazima

 On Feb 12, 4:35 pm, Gavin ga...@thinkersplayground.com wrote:

  Am I right in saying Daemons for frequent tasks (performing a specific
  check every minute or so) and cron jobs for less regular tasks
  (cleaning up sessions every week or so)?

  Are Daemons resource-intensive?

  On 12 Feb, 18:27, Chris Kottom chris.kot...@gmail.com wrote:

   +1 for implementing this as a cron job.  Sometimes the cleanest solution 
   is
   outside the framework.

   On Thu, Feb 12, 2009 at 4:20 PM, Gavin ga...@thinkersplayground.com 
   wrote:

Writing more unit tests for this as we speak

Thanks for the tip Robert

PS - I presume, if I were to use constants that I would define the
constants in the class itself?

On 12 Feb, 15:17, Robert Walker 
rails-mailing-l...@andreas-s.nethttps://mail.google.com/mail?view=cmtf=0to=rails-mailing-l...@andreas-s.net

wrote:
 Gavin wrote:
  So, would it be more appropriate to write a method like

  def purchased?
    if self.status  3
      return true
    else
      return false
    end
  end

  and then call the purchased? method to perform the check?

  On 12 Feb, 14:39, Robert Walker 
  rails-mailing-l...@andreas-s.nethttps://mail.google.com/mail?view=cmtf=0to=rails-mailing-l...@andreas-s.net

 Actually it could be as simple as adding some constants to represent
 your states.

 Example:
 STARTED = 1
 PROCESSING = 2
 COMPLETED = 3
 BILLED = 4
 PAID = 5

 if self.state  COMPLETED

 You just want to avoid the use of a magic number by giving it clear
 meaning.

 --
 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] Trying to Wrap My Head Around HM:t and HABTM w/ a Sample App

2009-02-12 Thread Josh Traxton

I am cheap and in an attempt to learn about rails  relationships I'm
trying to create an application that my friends and I can use as a way
to split the cost of items we buy @ Costco.

Right now the models i have are:

User - Various people involved
Run - Represents Costco runs
Item - Individual items purchased during a Costco run


I was hoping that someone could point me in the right direction as to
how i setup up the relationships...

These are my models:

Item.rb
# An item is purchased on a run and it's cost can be split between many
Users.  Because many Users can split the cost of an Item, it is owned by
1 or more Users.
belongs_to :run
belongs_to :user


Run.rb
# A run is an individual trip to costco.  On a run many items are
purchased.
has_many :items


User.rb
# A User can participate in many runs and during the run will be buying
Items (or maybe buying a fraction of 1 item).
has_many :runs
has_many :items, :through = :participations #This is my area of
question



I realize this is incorrect as is, but could someone shed some light on
how i should be thinking about a situation like this?

Thanks for your time and for reading a big post like this ;)
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Download Movie through link

2009-02-12 Thread Jeremy Olliver

I believe that the usual thing when sending files is to use the
webserver's filestreaming rather than rendering the file as text.

Try something like

send_file @movie.file_path, :disposition = :attachment

The disposition attachment option is actually set by default, but it
will provide the behavior you want of downloading, instead of trying
to open in the browser

On Feb 12, 10:59 pm, Deepak Mahajan rails-mailing-l...@andreas-s.net
wrote:
 Hitesh Rawal wrote:
  Deepak Mahajan wrote:
  MaD wrote:
  if i understand correctly you can click that link, choose the option
  'save as', download it to you hd and watch it. but you if you click
  the link and choose 'open', your video player opens but doesn't show
  any content. correct?

  if so i don't think it's a problem with your rails app, but with your
  operating system. because as i understand it, the file gets send
  correctly. maybe try another video-player. are you able to open other
  videos on the net (maybe upload one to a ftp and open it with your
  browser)?

  Hi MaD,

  Yes your understanding is correct as u mentioned in first.
  But I am able to open other videos on the net.

  I am a new I don't know why this link not prompt me(to download or
  open_with).
  but when I make a link of stored file it prompt correctly. So I thought
  some problem in my code.

  Please help me.

  Thanks

  As i understand you want application popup on link to download. if yes ?
  then set content-type as application.

  eg : �...@headers['Content-Type'] = 'application/force-download'

 Thanks Hitesh and MaD,

 I have changed the header content-type as 'application/force-download'.

 and It works.
 But when I click on open_with then It play movie on player as well as
 download also.
 even I remove force-download then also It download when I select
 open_with.

 can anybody have any idea?

 Thanks
 --
 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] manually setting an auto-incremented primary key id

2009-02-12 Thread Jamie Forrest

I want to create a record with a manually-set custom ID, for instance:

Foo.create(:id = 8000, :name =bar)

But when I try to do that, Rails ignores the id I pass and continues
to auto-increment the id in the table. So in other words the console
output is along the lines of:

 Foo.find(:last)
= #Foo id: 52, name: foo
 Foo.create(:id = 8000, :name =bar)
= #Foo id: 53, name: bar

What's the best way around this? (By the way, after I insert this
record with the custom ID, I *do* want it to revert back to auto-
incrementing the id.)

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



[Rails] Rails Music Composer

2009-02-12 Thread GabrielG1976


Hello Everyone,

I have just Created a Rails online music composing site.

 That allows users to create new musical compositions based off the
Conversion of text into a midi Composition.

and then can be used with 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] Re: Auto Complete

2009-02-12 Thread Miguel Regedor

yes, I realised I'll need to fill my data base with a bunch of
locations. It seems wikipedia has a big list of UK locations and towns
I'll have to do a parser to somehow retrieve that information. About
the plugin I would like to use jquery in my app, I found this plugin
http://github.com/chris/auto_complete_jquery/ but I noticed there is a
few more, is there some default in the community, or any big
differences between this and the one you suggested?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails Music Composer

2009-02-12 Thread GabrielG1976

Thanks I have alot plans for this site thanks for taking the time to
check it out..

On Feb 12, 12:40 am, LOUPOS KONSTANTINOS loup...@gmail.com wrote:
 Nice!!! Good job!

 On 11 Φεβ, 21:11, GabrielG1976 gabrielg1...@gmail.com wrote:

  I have just Created a Rails online music composing site.

   That allows users to create new musical compositions based off the
  Conversion of text into a midi Composition and then can be used with
  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] Re: Easy RoR - Javascript syntax question

2009-02-12 Thread Freddy Andersen

%= @cities %

On Feb 12, 9:13 am, Tom Ha rails-mailing-l...@andreas-s.net wrote:
 Hi there,

 a simple n00b question:

 I have that Javascript snippet on my page (see below; taken from jquery,
 actually).

 I want to pass it the @cities array from the controller. But what's
 the correct syntax, here?

 See the 3rd line:

 

 script
   $(document).ready(function(){
     var data = @cities;        that's not correct, is it?
     $(#city).autocomplete(data);
   });
 /script

 

 Thanks a lot for helping me!

 Tom
 --
 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: Easy RoR - Javascript syntax question

2009-02-12 Thread Tom Ha

Holy sh...

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] classic pagination with custom finders/sql

2009-02-12 Thread Ball Balla


Say I have a user model with the following

def active
 find(:all, :conditions = {:state = 'active'})
end

How can I get this working with classic pagination in my controller
without duplicating my logic for finding active users. ie, i do NOT
want to do this

def list
  @users = paginate(:users, :conditions = {:state = 'active'})
end

Is there anyway I can 'pull' the conditions out of the finder method?
-- 
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: templating-like system recommendations?

2009-02-12 Thread phil

Thanks Rick... I actually mentioned Liquid in my post. I was hoping
for a more robust framework / gem / base application to do more (like
drag and drop adding of model fields or some built in views for model
visibility) rather than having to code it all ourselves!

Thanks... maybe this is just the way it is.

On Feb 11, 3:12 pm, Rick Fiorentino rails-mailing-l...@andreas-s.net
wrote:
 Phil Smy wrote:
  No one is doing user-editable html pages?

 Hi Phil,

 There is liquid:http://www.liquidmarkup.org/

 It is not pure HTML but allows user-editing of pages. It is used in the
 shopify product offering. I have never used it, however, the developers
 of it are well known and top notch folks.

 It may not be exactly what you're looking for, but food for thought.

 Thanks,
 Rick
 --
 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] Building a directory tree into the database

2009-02-12 Thread elioncho

Hello,

Does anyone can give me some pointers on building a directory tree. I
want to map a directory of folders and files into a database. I am not
sure how to do this dynamically. I think acts_as_tree could help me do
this. Any ideas?

Thanks,

Elias
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: manually setting an auto-incremented primary key id

2009-02-12 Thread Rob Biedenharn

On Feb 12, 2009, at 4:21 PM, Jamie Forrest wrote:
 I want to create a record with a manually-set custom ID, for instance:

 Foo.create(:id = 8000, :name =bar)

 But when I try to do that, Rails ignores the id I pass and continues
 to auto-increment the id in the table. So in other words the console
 output is along the lines of:

 Foo.find(:last)
 = #Foo id: 52, name: foo
 Foo.create(:id = 8000, :name =bar)
 = #Foo id: 53, name: bar

 What's the best way around this? (By the way, after I insert this
 record with the custom ID, I *do* want it to revert back to auto-
 incrementing the id.)


Foo.create(:name = 'bar') do |foo|
   foo.id = 8000
end

One caveat however that bit me last week doing something similar when  
initializing some records in a new table.  PostgreSQL has a sequence  
created to support the auto-incrementing primary key (id) and I was  
getting unique index errors when new (or editted!) records were being  
saved and the sequence value was already a different record in the  
table.

(My solution was to manually next values off each of the two sequences  
until it would return a value that wasn't already a key.)

-Rob

Rob Biedenharn  http://agileconsultingllc.com
r...@agileconsultingllc.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] polymorphic nested resources

2009-02-12 Thread Marcelo de Moraes Serpa
Hello list,

What if I have a model called address that is polymorphic, and I also have
an address resource (as I want to try to follow a RESTful design) -- how
could I make polymorphic nested associations between addresses controller
and other related resources (users/1/addresses **and** orders/3/addresses).
What would be the easiest way to accomplish something like that?

Thanks,

Marcelo.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: polymorphic nested resources

2009-02-12 Thread Marcelo de Moraes Serpa
http://www.pathf.com/blogs/2008/07/drying-up-rails-controllers-polymorphic-and-super-controllers/

I think the article above pretty much answers my question. But please, if
anyone out there has any thoughts about it, I would love to know!

Thanks,

Marcelo.

On Thu, Feb 12, 2009 at 6:10 PM, Marcelo de Moraes Serpa 
celose...@gmail.com wrote:

 Hello list,

 What if I have a model called address that is polymorphic, and I also have
 an address resource (as I want to try to follow a RESTful design) -- how
 could I make polymorphic nested associations between addresses controller
 and other related resources (users/1/addresses **and** orders/3/addresses).
 What would be the easiest way to accomplish something like that?

 Thanks,

 Marcelo.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: jQuery's fancyZoom and delayedObserver conflict.

2009-02-12 Thread Marcelo de Moraes Serpa
Ok, here's why:

fancyZoom hides the target div, and its show() method then creates a
duplicate of this DOM subtree. The problem is that it keeps the same ids,
and we all know we can't have elements with the same ID -- thus, $() and
getElementById fail. The solution was to be more specific and select like
this: $('#zoom-content #id'), where #zoom-content is the name of the
duplicated div that fancyZoom creates, which is different from the hidden
div.

Marcelo.

On Wed, Feb 4, 2009 at 1:53 PM, Marcelo de Moraes Serpa celose...@gmail.com
 wrote:

 Hello list,

 I know this is more client-side stuff since I'm using Rails js helpers, I
 thought I would be posting here. http://pastie.org/379754 -- the
 delayedObserver simply doesn't work when fancyZoom is activated (it simply
 fails silently). If I remove the fancyZoom related code, it works ok. Here's
 a sample code: http://pastie.org/379754. Does anyone know why?

 Thanks,

 Marcelo.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: 2 button_to functions for file downloads

2009-02-12 Thread Me

Anyone have any idea why one button does a submit and the other does a
file download?

On Feb 11, 9:36 pm, Me chabg...@gmail.com wrote:
 I have2button_tofunctionsthat download2different files.  the
 first one acts like a submit and the second on actually does downlaod
 thefile.  Does anyone know what would cause that?

 %=button_to'Download PCCISfile',         :action = 'downloadpccis' %
 %=button_to'Download CISfile',   :action = 'downloadcis' %
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, 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   >