[Rails] Re: Please Help: Accessing Ruby app brings up Apache test page

2010-02-27 Thread rezilient
Any ideas?  Thanks for any advice.

On Feb 25, 9:09 pm, rezilient rezili...@gmail.com wrote:
 Hello.

 I finally got Ruby, Gem and Passenger installed without any glaring
 errors.

 ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux]
 gem 1.3.5

 I added the following lines to my httpd.conf:

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

 (confirmed the files/folders are present)

 and for the virtual host we have:

 VirtualHost 69.69.69.169.80
 SuexecUserGroup #528 #529
 ServerName clockingit.mywebsite.com
 ServerAliaswww.clockingit.mywebsite.com
 ServerAlias webmail.clockingit.mywebsite.com
 ServerAlias admin.clockingit.mywebsite.com
 DocumentRoot /home/mywebsite/domains/clockingit.mywebsite.com/
 clockingit/public
 ErrorLog /var/log/virtualmin/clockingit.mywebsite.com_error_log
 CustomLog /var/log/virtualmin/clockingit.mywebsite.com_access_log
 combined
 #ScriptAlias /cgi-bin/ /home/mywebsite/domains/
 clockingit.mywebsite.com/cgi-bin/
 #ScriptAlias /awstats /home/mywebsite/domains/clockingit.mywebsite.com/
 cgi-bin
 #DirectoryIndex index.html index.htm index.php index.php4 index.php5
 Directory /home/mywebsite/domains/clockingit.mywebsite.com/clockingit/
 public
 Options -Indexes FollowSymLinks -MultiViews
 allow from all
 AllowOverride All
 RailsEnv production
 PassengerHighPerformance on
 /Directory
 #Directory /home/mywebsite/domains/clockingit.mywebsite.com/cgi-bin
 #allow from all
 #/Directory
 #RewriteEngine on
 #RewriteCond %{HTTP_HOST} =webmail.clockingit.mywebsite.com
 #RewriteRule ^(.*)https://clockingit.mywebsite.com:2/[R]
 #RewriteCond %{HTTP_HOST} =admin.clockingit.mywebsite.com
 #RewriteRule ^(.*)https://clockingit.mywebsite.com:1/[R]
 #Files awstats.pl
 #AuthName clockingit.mywebsite.com statistics
 #AuthType Basic
 #AuthUserFile /home/mywebsite/domains/
 clockingit.mywebsite.com/.awstats-htpasswd
 #require valid-user
 #/Files
 #Alias /dav /home/mywebsite/domains/clockingit.mywebsite.com/
 clockingit/public
 #Location /dav
 #DAV On
 #AuthType Basic
 #AuthName clockingit.mywebsite.com
 #AuthUserFile /home/mywebsite/domains/clockingit.mywebsite.com/etc/
 dav.digest.passwd
 #Require valid-user
 #ForceType text/plain
 #Satisfy All
 #/Location
 /VirtualHost

 A lot of the stuff I commented out above came from Virtualmin so I cut
 it down to the basics that Passenger guide suggested.

 When I hit the site I am getting the default Apache 2 Test Page.
 When I put a test index.html in public for this app (the app is
 called clockingIT) the index.html is loading as expected, as if Ruby
 doesn't exist.

 So I'm guessing something is missing.. How can I check if Passenger is
 loaded correctly?  I don't get any errors when I start Apache, so...

 Thanks for any help!!

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



[Rails] Re: How do you allow users make custom shopping lists?

2010-02-27 Thread Phoenix
I'd start by creating various models to represent the user, the lists,
the items *in* the lists, and a pairing relationship between them (aka
a join table, or in Rails lingo, a has many through
relationship).  For example, you could have 4 models:

User
ShoppingList
Food
Foodable (the join model)

User has all the standard fields you need for a user with
authentication, etc.  To handle authentication, do a Google search for
authlogic and do some reading on it.

ShoppingList consists only of:

user_id
name

(You could also add notes or something to that effect here too, if
you wanted.)

Finally, Food would simply be:

name

...that's it.  So now you have:

User:
---
id
username
email
...etc...

ShoppingList
--
id
user_id
name

Food
--
id
name

Foodable (the join model between foods and shopping lists)
-
id
shopping_list_id
food_id

So you can see how, using foreign keys, we can link any number of
foods to multiple shopping lists without duplicating information in
the database.  For example, if we had a food called T-Bone Steak, it
only needs to be listed in the database ONCE.  Not hundreds of times.
Then, in the Foodable join table, we link its unique ID in the food
table (say that ID is 199) to every list in which it appears.

By linking the shopping list model directly to the user model (so
shopping_list belongs_to :user), we ensure that any single shopping
list belongs to ONLY one user at any given time, meaning that your
database select query (or a find on that model) will only return the
lists that specific user owns, never anyone else's, making it all but
impossible that user A would see user B's list.

This is basically a data architecture/database normalization problem.
I suggest looking up the basics of how ActiveRecord works, especially
model relationships such as belongs_to and has_many with the :through
option (you could also do a has_and_belongs_to_many, but I hear that
practice is falling out of favor these days because the
has_many :through allows you to work directly with the join model and
does the same thing.)

You were on the right track checking out Railscasts - Ryan does a
great job of breaking down complex topics to make them easy to
understand.  I suggest you look through it a bit more to learn more
about how ActiveRecord works.  In addition, check out Rails Guides:

http://guides.rubyonrails.org/getting_started.html
 - Will help make sure you have the foundational knowledge you need to
get started
http://guides.rubyonrails.org/association_basics.html
 - Explains ActiveRecord associations like has_many, belongs_to,
has_many :through, etc.

Good luck.

On Feb 26, 11:21 pm, The_programmer kingz...@gmail.com wrote:
 Hi,
 I asked Ryan bates, the owner of railscasts.com if he knew of any
 documentation that would explain what code to use to allow users make
 their own lists in RoR. He referred me to here. I'm trying to make it
 so user A can make a shopping list and populate it with items like
 eggs, fruit, oatmeal, etc. I know that I could easily make one
 shopping list for all users to use but my situation is different. I
 want user A to be able to make a list for different types of food and
 such. The problem is, I don't know if this is possible or how to do it
 without other users seeing their shopping list.  I'm very adamant on
 letting users make their own shopping lists so any info on how to do
 that is very much appreciated.

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



[Rails] Re: Re: Rails instalation under Windows - problem

2010-02-27 Thread Jan Kunes
Hi Rajeev, thanks. You helped me a lot. Now I have running Instant 
Rails, but how to force it to work together with some IDE (Aptana, 
Netbeans)? Error messages like wrong gems, cannot launch mongrel server 
etc. appear when I'm trying to run sample application inside these 
tools.
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: date_select with Searchlogic

2010-02-27 Thread goodwill
+1, hit this nail right on today :(

On Feb 25, 7:27 pm, Stuart Corbishley li...@ruby-forum.com wrote:
 I am aware that date selects params are supposed to supported by
 Searchlogic.

 But I'm battling to get them working.

 I am using one of the named_scopes that it makes, and it works perfectly
 in the console:

 User.created_at_gte(1.year.ago)

 this behaves as expected.

 In my view I have this:

 - form_for @search do |f|
   Surname
   =f.text_field :surname_like
   Age between
   =f.text_field :age_gte
   =f.text_field :age_lte
   Joined after
   =f.date_select :created_at_gte

   =f.submit Search

 the error I get is when actually using the field, I get this error:
 The  is not a valid condition. You may only use conditions that map to a
 named scope

 and the params are:

 {commit=Search,
  search={created_at_gte(1i)=2011,
  created_at_gte(2i)=2,
  created_at_gte(3i)=25,
  age_gte=5,
  order=,
  surname_like=,
  age_lte=25}}

 Now unless I'm wrong, searchlogic should be able to parse the params
 with their date groups. Or it's just being stupid and thinking
 created_at_gte(1i) is a named scope. In which case I'm going to have
 to alter the params to make it friendly for searchlogic.

 anythink I'm missing?
 --
 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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] How to generate this URL

2010-02-27 Thread east
I'm stumped trying to generate an URL for a working route.  I've this
route definition:

  map.connect 'foo/:foo_id/propose_something/:zap_id',
  :controller = foo,
  :action = propose_something

When I browse to this url: http://localhost:3000/foo/2/propose_something/5,
my propose_something method gets invoked with the correct params
hash.  So one would think that all is good, but I'm stuck trying to
generate the corresponding URL to pass to link_to.

I would think that this would do it:
 url_for(:controller = foo, :action = 'propose_something', :foo_id
= 1, :zap_id = 13)

But this generates this URL:
http://localhost:3000/foo/propose_something?foo_id=1zap_id=13

To work around this, I've constructed the string manually, but that
feels nasty in all sorts of ways...

Can someone point out what the heck I'm doing wrong?

Thanks,
east

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



[Rails] Oniguruma and Ultraviolet on Windows 7

2010-02-27 Thread amacgregor
Hi I have been tying to install the followings gems in order to add
code syntax highlighting to my application:

-Oniguruma
-Ultraviolet
-Harsh

Unfortunately I have been running into the the following errors when
running gem install oniguruma ultraviolet

Building native extensions.  This could take a while...
ERROR:  Error installing oniguruma:
ERROR: Failed to build gem native extension.

C:/Ruby19/bin/ruby.exe extconf.rb
checking for main() in -lonig... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby19/bin/ruby
--with-oniglib
--without-oniglib
C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed
to generat
e an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:417:in `try_link0'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:421:in `try_link'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:529:in `try_func'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:725:in `block in
have_library'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:670:in `block in
checking_for'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block (2 levels)
in postpo
ne'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block in
postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:272:in `postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:720:in `have_library'
from extconf.rb:2:in `main'


Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/
oniguruma-
1.1.0 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/oniguruma-1.1.0/
ext/gem_mak
e.out
Building native extensions.  This could take a while...
ERROR:  Error installing ultraviolet:
ERROR: Failed to build gem native extension.

C:/Ruby19/bin/ruby.exe extconf.rb
checking for main() in -lonig... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby19/bin/ruby
--with-oniglib
--without-oniglib
C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed
to generat
e an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:417:in `try_link0'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:421:in `try_link'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:529:in `try_func'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:725:in `block in
have_library'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:670:in `block in
checking_for'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block (2 levels)
in postpo
ne'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block in
postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:272:in `postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:720:in `have_library'
from extconf.rb:2:in `main'


Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/
oniguruma-
1.1.0 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/oniguruma-1.1.0/
ext/gem_mak
e.out

I'm using windows 7 with
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
mysql (2.8.1)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)

Any help that anyone can give me to resolve this issue is highly
appreciated.

Cheers!

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 

[Rails] Re: Turn of a single validation

2010-02-27 Thread Frederick Cheung


On Feb 26, 6:39 pm, Ralph Shnelvar li...@ruby-forum.com wrote:
 Colin Law wrote:
 You are doing a migration not a
  seed aren't you?).

 I'm doing  a seed with random data and I want all the validations ...
 except one.

 I know.  I know.  I'm bad bad bad.  But this is a hack AND I'd like to
 know if the hack can be done.

You could probably twist the :if/:unless options for this, although it
will almost certainly come and bite you later on.

Fred
 --
 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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Re: Rails instalation under Windows - problem

2010-02-27 Thread kannav rajeev
dO NOT TRY ide FOR rails there is sach a no need trust me ok if stiil
error come print that here

On 2/27/10, Jan Kunes li...@ruby-forum.com wrote:
 Hi Rajeev, thanks. You helped me a lot. Now I have running Instant
 Rails, but how to force it to work together with some IDE (Aptana,
 Netbeans)? Error messages like wrong gems, cannot launch mongrel server
 etc. appear when I'm trying to run sample application inside these
 tools.
 --
 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-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.




-- 
Thanks:
Rajeev sharma

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



[Rails] Re: Re: Rails instalation under Windows - problem

2010-02-27 Thread Jan Kunes
Well, you confused me a little bit ;-). Where do you write your apps? In 
notepad? And how do you test them?

Thanks
Jan

kannav rajeev wrote:
 TRy instant rails it works
 do not waste yours time still need to install we are here
 
 
 On Sat, Feb 27, 2010 at 12:44 PM, Jan Kunes li...@ruby-forum.com 
 wrote:
 

 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.


 
 
 --
 Thanks:
 Rajeev sharma

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: cucumber directories not working

2010-02-27 Thread Phillip Koebbe
Chris Habgood wrote:
 I figured out it was the rerun.txt file in the root directory which had 
 the
 old directories from the first run.  live and learn. DOH.

Heh. That file has been the confusion of many newcomers to Cucumber. You 
are just another a growing list of learners.

Peace,
Phillip
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Re: Rails instalation under Windows - problem

2010-02-27 Thread kannav rajeev
listen Use
instant rails Notepad ++ as a editor for a while take a tour of instant rails


On 2/27/10, Jan Kunes li...@ruby-forum.com wrote:
 Well, you confused me a little bit ;-). Where do you write your apps? In
 notepad? And how do you test them?

 Thanks
 Jan

 kannav rajeev wrote:
 TRy instant rails it works
 do not waste yours time still need to install we are here


 On Sat, Feb 27, 2010 at 12:44 PM, Jan Kunes li...@ruby-forum.com
 wrote:


 .
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.




 --
 Thanks:
 Rajeev sharma

 --
 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-t...@googlegroups.com.
 To unsubscribe from this group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.




-- 
Thanks:
Rajeev sharma

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



Re: [Rails] Re: Re: Turn of a single validation

2010-02-27 Thread Xavier Noria
On Fri, Feb 26, 2010 at 7:39 PM, Ralph Shnelvar li...@ruby-forum.com wrote:
 Colin Law wrote:

You are doing a migration not a
 seed aren't you?).

 I'm doing  a seed with random data and I want all the validations ...
 except one.

Another option: If you can trust your seed data save(false) turns off
validations.

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



Re: [Rails] Re: Please Help: Accessing Ruby app brings up Apache test page

2010-02-27 Thread Simon Macneall

Shouldn't the virtual host be

VirtualHost 69.69.69.169:80

Note the colon?

Cheers
Simon

On Sat, 27 Feb 2010 16:22:20 +0800, rezilient rezili...@gmail.com wrote:


Any ideas?  Thanks for any advice.

On Feb 25, 9:09 pm, rezilient rezili...@gmail.com wrote:

Hello.

I finally got Ruby, Gem and Passenger installed without any glaring
errors.

ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux]
gem 1.3.5

I added the following lines to my httpd.conf:

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

(confirmed the files/folders are present)

and for the virtual host we have:

VirtualHost 69.69.69.169.80
SuexecUserGroup #528 #529
ServerName clockingit.mywebsite.com
ServerAliaswww.clockingit.mywebsite.com
ServerAlias webmail.clockingit.mywebsite.com
ServerAlias admin.clockingit.mywebsite.com
DocumentRoot /home/mywebsite/domains/clockingit.mywebsite.com/
clockingit/public
ErrorLog /var/log/virtualmin/clockingit.mywebsite.com_error_log
CustomLog /var/log/virtualmin/clockingit.mywebsite.com_access_log
combined
#ScriptAlias /cgi-bin/ /home/mywebsite/domains/
clockingit.mywebsite.com/cgi-bin/
#ScriptAlias /awstats /home/mywebsite/domains/clockingit.mywebsite.com/
cgi-bin
#DirectoryIndex index.html index.htm index.php index.php4 index.php5
Directory /home/mywebsite/domains/clockingit.mywebsite.com/clockingit/
public
Options -Indexes FollowSymLinks -MultiViews
allow from all
AllowOverride All
RailsEnv production
PassengerHighPerformance on
/Directory
#Directory /home/mywebsite/domains/clockingit.mywebsite.com/cgi-bin
#allow from all
#/Directory
#RewriteEngine on
#RewriteCond %{HTTP_HOST} =webmail.clockingit.mywebsite.com
#RewriteRule ^(.*)https://clockingit.mywebsite.com:2/[R]
#RewriteCond %{HTTP_HOST} =admin.clockingit.mywebsite.com
#RewriteRule ^(.*)https://clockingit.mywebsite.com:1/[R]
#Files awstats.pl
#AuthName clockingit.mywebsite.com statistics
#AuthType Basic
#AuthUserFile /home/mywebsite/domains/
clockingit.mywebsite.com/.awstats-htpasswd
#require valid-user
#/Files
#Alias /dav /home/mywebsite/domains/clockingit.mywebsite.com/
clockingit/public
#Location /dav
#DAV On
#AuthType Basic
#AuthName clockingit.mywebsite.com
#AuthUserFile /home/mywebsite/domains/clockingit.mywebsite.com/etc/
dav.digest.passwd
#Require valid-user
#ForceType text/plain
#Satisfy All
#/Location
/VirtualHost

A lot of the stuff I commented out above came from Virtualmin so I cut
it down to the basics that Passenger guide suggested.

When I hit the site I am getting the default Apache 2 Test Page.
When I put a test index.html in public for this app (the app is
called clockingIT) the index.html is loading as expected, as if Ruby
doesn't exist.

So I'm guessing something is missing.. How can I check if Passenger is
loaded correctly?  I don't get any errors when I start Apache, so...

Thanks for any help!!




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



Re: [Rails] How to generate this URL

2010-02-27 Thread Craig White
On Fri, 2010-02-26 at 17:44 -0800, east wrote:
 I'm stumped trying to generate an URL for a working route.  I've this
 route definition:
 
   map.connect 'foo/:foo_id/propose_something/:zap_id',
   :controller = foo,
   :action = propose_something
 
 When I browse to this url: http://localhost:3000/foo/2/propose_something/5,
 my propose_something method gets invoked with the correct params
 hash.  So one would think that all is good, but I'm stuck trying to
 generate the corresponding URL to pass to link_to.
 
 I would think that this would do it:
  url_for(:controller = foo, :action = 'propose_something', :foo_id
 = 1, :zap_id = 13)
 
 But this generates this URL:
 http://localhost:3000/foo/propose_something?foo_id=1zap_id=13
 
 To work around this, I've constructed the string manually, but that
 feels nasty in all sorts of ways...
 
 Can someone point out what the heck I'm doing wrong?

url_for(:controller = foo, :action = ('/' + :foo_id +
'/propose_something'), :zap_id = 13)

You might not need the parens but it tends to help me spot what the intent was 
right away.

That said, I probably would rethink my 'routes' and use routes and methods that 
tended towards standardization and have my methods parse the params.

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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



[Rails] Re: Oniguruma and Ultraviolet on Windows 7

2010-02-27 Thread Frederick Cheung


On Feb 27, 3:02 am, amacgregor d...@allanmacgregor.com wrote:
 Hi I have been tying to install the followings gems in order to add
 code syntax highlighting to my application:


Do you have the correct compiler toolchain installed (from the log
looks like minggw32) ?
It also looks like someone forked ultraviolet and that the fork
( http://github.com/spox/ultraviolet ) is ruby 1.9 compatible which
rather implies that the original isn't. It doesn't look like the fork
has any native code dependencies (onigurama is a regular express
library which has become the standard ruby one in ruby 1.9)

Fred
 -Oniguruma
 -Ultraviolet
 -Harsh

 Unfortunately I have been running into the the following errors when
 running gem install oniguruma ultraviolet

 Building native extensions.  This could take a while...
 ERROR:  Error installing oniguruma:
         ERROR: Failed to build gem native extension.

 C:/Ruby19/bin/ruby.exe extconf.rb
 checking for main() in -lonig... *** extconf.rb failed ***
 Could not create Makefile due to some reason, probably lack of
 necessary libraries and/or headers.  Check the mkmf.log file for more
 details.  You may need configuration options.

 Provided configuration options:
         --with-opt-dir
         --without-opt-dir
         --with-opt-include
         --without-opt-include=${opt-dir}/include
         --with-opt-lib
         --without-opt-lib=${opt-dir}/lib
         --with-make-prog
         --without-make-prog
         --srcdir=.
         --curdir
         --ruby=C:/Ruby19/bin/ruby
         --with-oniglib
         --without-oniglib
 C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed
 to generat
 e an executable file. (RuntimeError)
 You have to install development tools first.
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:417:in `try_link0'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:421:in `try_link'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:529:in `try_func'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:725:in `block in
 have_library'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:670:in `block in
 checking_for'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block (2 levels)
 in postpo
 ne'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block in
 postpone'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:272:in `postpone'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:720:in `have_library'
         from extconf.rb:2:in `main'

 Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/
 oniguruma-
 1.1.0 for inspection.
 Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/oniguruma-1.1.0/
 ext/gem_mak
 e.out
 Building native extensions.  This could take a while...
 ERROR:  Error installing ultraviolet:
         ERROR: Failed to build gem native extension.

 C:/Ruby19/bin/ruby.exe extconf.rb
 checking for main() in -lonig... *** extconf.rb failed ***
 Could not create Makefile due to some reason, probably lack of
 necessary libraries and/or headers.  Check the mkmf.log file for more
 details.  You may need configuration options.

 Provided configuration options:
         --with-opt-dir
         --without-opt-dir
         --with-opt-include
         --without-opt-include=${opt-dir}/include
         --with-opt-lib
         --without-opt-lib=${opt-dir}/lib
         --with-make-prog
         --without-make-prog
         --srcdir=.
         --curdir
         --ruby=C:/Ruby19/bin/ruby
         --with-oniglib
         --without-oniglib
 C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed
 to generat
 e an executable file. (RuntimeError)
 You have to install development tools first.
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:417:in `try_link0'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:421:in `try_link'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:529:in `try_func'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:725:in `block in
 have_library'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:670:in `block in
 checking_for'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block (2 levels)
 in postpo
 ne'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block in
 postpone'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:272:in `postpone'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for'
         from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:720:in `have_library'
         from extconf.rb:2:in `main'

 Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/
 oniguruma-
 1.1.0 for inspection.
 Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/oniguruma-1.1.0/
 ext/gem_mak
 e.out

 I'm using windows 7 with
 ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]


Re: [Rails] Help! Invalid character in IE

2010-02-27 Thread Charles A. Lopez
interesting... sample code please?

can we see the AJAX call?

Can you submit from IE with different parameters that will avoid the error
message?

On 27 February 2010 00:06, John Shen jshen2...@gmail.com wrote:

 Hi, folks,

 I have been wrestling with this for a couple of days now.  Everything
 works great on all browsers except IE!

 IE keeps giving errors like Invalid character ...line 2 character 1
 when an AJAX call is submitted.
 The call will succeed and the page will be updated correctly, but
 always generates the annoying error!

 I have set the character set to 'utf-8' and set the response header to
 'utf-8' as well, so there is no character set mismatch here.

 Anybody had similar problems before can give me some help?

 Thanks in advance!

 John

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




-- 
Charles A. Lopez
charlesalo...@gmail.com

What's your vision for your organization?
What's your biggest challenge?

Let's talk.
(IBM Partner)

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



[Rails] Re: Oniguruma and Ultraviolet on Windows 7

2010-02-27 Thread amacgregor
Hi Frederick,

I actually was able to install both ultraviolet and oniguruma with the
following commands :
gem install oniguruma --platform=mingw32
gem install ultraviolet --platform=mingw32

So know when I run gem list --local I see

*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
git (1.2.5)
hpricot (0.8.2)
mysql (2.8.1)
oniguruma (1.1.0)
plist (3.1.0)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
textpow (0.10.1)
ultraviolet (0.10.2)


But know I'm having a different problem running script/plugin install
git://github.com/michaeledgar/harsh.git I always get Plugin not found:
[git://github.com/michaeledgar/harsh.git]

I get the same error with all the plugins I try to install, I also
tried replacing git with http:// and adding a trailing slash at the
end but with the same result.

I also tried downloading the plugin manually and copying it to the
vendor folder, but is not making the correct replacement and when I
try to run the rake tasks from the plugin I get the following error
output :

rake harsh:theme:list

(in O:/Personal/2010/allanmacgregor.com/RubyMineProjects/Snippy)
C:/Ruby19/lib/ruby/gems/1.9.1/gems/oniguruma-1.1.0/lib/oniguruma.rb:
1:in `requir
e': 126: The specified module could not be found.   - C:/Ruby19/lib/
ruby/gems/1.
9.1/gems/oniguruma-1.1.0-x86-mswin32/win/oregexp.so (LoadError)
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/oniguruma-1.1.0/lib/
oniguruma.rb
:1:in `top (required)'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/textpow-0.10.1/lib/
textpow.rb:2:
in `require'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/textpow-0.10.1/lib/
textpow.rb:2:
in `top (required)'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/ultraviolet-0.10.2/lib/
uv.rb:2:i
n `require'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/ultraviolet-0.10.2/lib/
uv.rb:2:i
n `top (required)'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/ultraviolet-0.10.2/bin/
uv:8:in `
require'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/ultraviolet-0.10.2/bin/
uv:8:in `
rescue in top (required)'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/ultraviolet-0.10.2/bin/
uv:3:in `
top (required)'
from C:/Ruby19/bin/uv:19:in `load'
from C:/Ruby19/bin/uv:19:in `main'

Any help getting this solved is highly appreciated

Cheers!


On Feb 27, 10:19 am, Frederick Cheung frederick.che...@gmail.com
wrote:
 On Feb 27, 3:02 am, amacgregor d...@allanmacgregor.com wrote:

  Hi I have been tying to install the followings gems in order to add
  code syntax highlighting to my application:

 Do you have the correct compiler toolchain installed (from the log
 looks like minggw32) ?
 It also looks like someone forked ultraviolet and that the fork
 (http://github.com/spox/ultraviolet) is ruby 1.9 compatible which
 rather implies that the original isn't. It doesn't look like the fork
 has any native code dependencies (onigurama is a regular express
 library which has become the standard ruby one in ruby 1.9)

 Fred

  -Oniguruma
  -Ultraviolet
  -Harsh

  Unfortunately I have been running into the the following errors when
  running gem install oniguruma ultraviolet

  Building native extensions.  This could take a while...
  ERROR:  Error installing oniguruma:
          ERROR: Failed to build gem native extension.

  C:/Ruby19/bin/ruby.exe extconf.rb
  checking for main() in -lonig... *** extconf.rb failed ***
  Could not create Makefile due to some reason, probably lack of
  necessary libraries and/or headers.  Check the mkmf.log file for more
  details.  You may need configuration options.

  Provided configuration options:
          --with-opt-dir
          --without-opt-dir
          --with-opt-include
          --without-opt-include=${opt-dir}/include
          --with-opt-lib
          --without-opt-lib=${opt-dir}/lib
          --with-make-prog
          --without-make-prog
          --srcdir=.
          --curdir
          --ruby=C:/Ruby19/bin/ruby
          --with-oniglib
          --without-oniglib
  C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed
  to generat
  e an executable file. (RuntimeError)
  You have to install development tools first.
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:417:in `try_link0'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:421:in `try_link'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:529:in `try_func'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:725:in `block in
  have_library'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:670:in `block in
  checking_for'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block (2 levels)
  in postpo
  ne'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:276:in `block in
  postpone'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:250:in `open'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:272:in `postpone'
          from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for'
         

[Rails] Re: Rails instalation under Windows - problem

2010-02-27 Thread amacgregor
Kannav,

I disagree there are some very very good editors for Rails, and having
rails and ruby directly installed instead of using instant rails is
way better option.

Jan,

You should try rubymine, is a great editor for the installation
problem you where having what version of windows are you using ?

Cheers!

On Feb 27, 8:38 am, kannav rajeev rajeevsharm...@gmail.com wrote:
 listen Use
 instant rails Notepad ++ as a editor for a while take a tour of instant rails

 On 2/27/10, Jan Kunes li...@ruby-forum.com wrote:



  Well, you confused me a little bit ;-). Where do you write your apps? In
  notepad? And how do you test them?

  Thanks
  Jan

  kannav rajeev wrote:
  TRy instant rails it works
  do not waste yours time still need to install we are here

  On Sat, Feb 27, 2010 at 12:44 PM, Jan Kunes li...@ruby-forum.com
  wrote:

  .
  For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.

  --
  Thanks:
  Rajeev sharma

  --
  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-t...@googlegroups.com.
  To unsubscribe from this group, send email to
  rubyonrails-talk+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.

 --
 Thanks:
 Rajeev sharma

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



[Rails] Re: Plugin not found

2010-02-27 Thread amacgregor
Hi Marc,

I'm having the same problem where you able to find a solution ?

On Feb 24, 4:30 pm, Marc Luzietti absyn...@gmail.com wrote:
 I'm using Ruby 1.8.7 and Rails 2.3.5. I'm in aWindowsXP environment.

 Whenever I run ruby script/plugininstallyada/yada/yada I get:

 Pluginnot found [yada yada yada]

 It doesn't matter if I use git://,http://git.,http://svn, with or
 without a trailing slash, or even if I download the source code
 directly to vendor/plugins and give the path. It always fails.

 I've had this problem today with both attachment_fu and will_paginate.

 Marc Luzietti

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

2010-02-27 Thread gdonald


On Feb 27, 5:07 am, Jan Kunes li...@ruby-forum.com wrote:
 Where do you write your apps? In notepad?

Emacs, for example here it is on win7:

http://static.destiney.com/emacs_screen_shot.jpg

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



[Rails] Re: Re: Rails instalation under Windows - problem

2010-02-27 Thread Damjan Rems
Jan Kunes wrote:
 Hi Rajeev, thanks. You helped me a lot. Now I have running Instant 
 Rails, but how to force it to work together with some IDE (Aptana, 
 Netbeans)? Error messages like wrong gems, cannot launch mongrel server 
 etc. appear when I'm trying to run sample application inside these 
 tools.

I am using Netbeans all the time, but never come to mind using build in 
application server.

I simply start DOS (command) window, cd to root directory of your app 
and run:

ruby script\server

This will run webrick or mongrel if it is installed.


by
Ther


-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email 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 instalation under Windows - problem

2010-02-27 Thread amacgregor
Or if you prefer and editor instead an IDE e-text editor is also very
good, is textmate for windows basically http://yfrog.com/i3etextj
running on windows 7

On Feb 27, 8:07 am, Jan Kunes li...@ruby-forum.com wrote:
 Well, you confused me a little bit ;-). Where do you write your apps? In
 notepad? And how do you test them?

 Thanks
 Jan



 kannav rajeev wrote:
  TRy instant rails it works
  do not waste yours time still need to install we are here

  On Sat, Feb 27, 2010 at 12:44 PM, Jan Kunes li...@ruby-forum.com
  wrote:

  .
  For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.

  --
  Thanks:
  Rajeev sharma

 --
 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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] %= % Interpolation question

2010-02-27 Thread Dudebot
Is there a way to get a Rails view to interpolate inside %= %?
E.g. if foo = '%= bar %' and bar = '2',
to have some variant of %= foo % in app/views/whatever/
whatever.html.erb display '2' rather than '%= bar %'?

Many TIA,
Craig

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



Re: [Rails] %= % Interpolation question

2010-02-27 Thread Craig White
On Sat, 2010-02-27 at 07:08 -0800, Dudebot wrote:
 Is there a way to get a Rails view to interpolate inside %= %?
 E.g. if foo = '%= bar %' and bar = '2',
 to have some variant of %= foo % in app/views/whatever/
 whatever.html.erb display '2' rather than '%= bar %'?

lots of ways... choose whatever is best for the situation...

%= @foo == 'bar' ? result 1 : result 2 %

or 

% if @foo == 'bar' -%
 %= 'result 1' %
% else -%
 %= 'result 2' %
% end -%

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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



[Rails] Postgresql error in connecting to database - invalid response to ssl negotiation

2010-02-27 Thread @shaan
Hello,

I have a rails application with PostgreSQL as the database. The
application works fine on my development PC.

I deployed this application to a server PC (different one), where I am
getting the following error -

PGError in StudentsController#home

received invalid response to SSL negotiation: -

The error trace is as below -

C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/
postgresql_adapter.rb:713:in `initialize'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/
postgresql_adapter.rb:713:in `connect'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/
postgresql_adapter.rb:713:in `connect'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/
postgresql_adapter.rb:237:in `initialize'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/
postgresql_adapter.rb:23:in `new'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/
postgresql_adapter.rb:23:in `postgresql_connection'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/abstract/
connection_specification.rb:291:in `send'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/abstract/
connection_specification.rb:291:in `connection='
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/abstract/
connection_specification.rb:259:in `retrieve_connection'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/abstract/
connection_specification.rb:78:in `connection'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/caching.rb:677:in
`perform_action'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/base.rb:524:in `send'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/base.rb:524:in
`process_without_filters'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/filters.rb:685:in
`process_without_session_management_support'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
`process'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
`handle_request'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
`dispatch_cgi'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:76:in `process'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:74:in `synchronize'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:74:in `process'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:159:in `process_client'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:158:in `each'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:158:in `process_client'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in `run'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in `initialize'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/
mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in `new'
C:/DOCUME~1/ADMINI~1/eee/eee.exide.exe.3/lib/rubyscript2exe.gems/gems/

[Rails] Re: Rails instalation under Windows - problem

2010-02-27 Thread Jan Kunes
Hello guys, thanks for all your advices, I really appreciated them. I 
decided to stay with Notepad++ as an editor for now. I moved forward, 
but...

I created my own application directory (command: rails myapp) and I can 
see ruby welcome page when I put localhost:3000 in to browser. Now, I 
don't know how to force ruby to take in to mind my .rb file with sample 
code (puts Hello world!) which I saved in to myapp directory 
structure. Sorry for really newbie question, but I've just started.

Thanks,
Jan
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Rails instalation under Windows - problem

2010-02-27 Thread Colin Law
On 27 February 2010 15:37, Jan Kunes li...@ruby-forum.com wrote:
 Hello guys, thanks for all your advices, I really appreciated them. I
 decided to stay with Notepad++ as an editor for now. I moved forward,
 but...

 I created my own application directory (command: rails myapp) and I can
 see ruby welcome page when I put localhost:3000 in to browser. Now, I
 don't know how to force ruby to take in to mind my .rb file with sample
 code (puts Hello world!) which I saved in to myapp directory
 structure. Sorry for really newbie question, but I've just started.

Have a look at the Getting Started rails guide at
http://guides.rubyonrails.org/.  And the other guides for that matter.

Colin

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



Re: [Rails] Re: %= % Interpolation question

2010-02-27 Thread Craig White
On Sat, 2010-02-27 at 07:43 -0800, Dudebot wrote:
 Thanks, Craig--I think my example was too terse.  What I'm trying to
 do is to pass a block of text to a view which may contain multiple
 references to external models, and I'd like to interpolate those
 references.
 
 So, for example, if @thing.body =  This is the id of foo: %= @foo.id
 % and this is its body: %= @foo.body % 
 
 If @foo.id = 2 and @foo.body = Norman, I'd like in the view
 whatever.html.erb to have
 
 %= @thing.body %
 
 display
 
 This is the id of foo: 2 and this is its body: Norman
 
 Is there a way to do that?  I also tried #{ ... } and am still getting
 the literal rather than the interpolation.

try actual code examples

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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

2010-02-27 Thread Ken Paul
Rails 3 requires bundler to be installed, but bundler can't be installed
on Debian lenny because the gem version 1.2 is too old, an attempt
update is also failed, any idea?

# gem update --system
ERROR:  While executing gem ... (RuntimeError)
gem update --system is disabled on Debian. RubyGems can be updated
using the
 official Debian repositories by aptitude or apt-get.
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: %= % Interpolation question

2010-02-27 Thread AGoofin
%= bar.to_s %

On Feb 27, 11:30 am, Dudebot craign...@gmail.com wrote:
 OK, here's what I have in app/views/molds/show.html.erb:

 trtd%= @mold.body.gsub( \n, br / ) %/td/tr

 The controller finds @patient, and @patient.id = 2

 If @mold.body = The patients id is %= @patient.id %

 Then the view displays

 The patients id is %= @patient.id %

 rather than

 The patients id is 2

 Same goes for replacing %= with #{ and % with }

 Many TIA,
 Craig

 On Feb 27, 10:21 am, Craig White craigwh...@azapple.com wrote:

  On Sat, 2010-02-27 at 07:43 -0800, Dudebot wrote:
   Thanks, Craig--I think my example was too terse.  What I'm trying to
   do is to pass a block of text to a view which may contain multiple
   references to external models, and I'd like to interpolate those
   references.

   So, for example, if @thing.body =  This is the id of foo: %= @foo.id
   % and this is its body: %= @foo.body % 

   If @foo.id = 2 and @foo.body = Norman, I'd like in the view
   whatever.html.erb to have

   %= @thing.body %

   display

   This is the id of foo: 2 and this is its body: Norman

   Is there a way to do that?  I also tried #{ ... } and am still getting
   the literal rather than the interpolation.

  
  try actual code examples

  Craig

  --
  This message has been scanned for viruses and
  dangerous content by MailScanner, and is
  believed to be clean.

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



Re: [Rails] rails 3 on debian

2010-02-27 Thread Hassan Schroeder
On Sat, Feb 27, 2010 at 8:24 AM, Ken Paul li...@ruby-forum.com wrote:
 Rails 3 requires bundler to be installed, but bundler can't be installed
 on Debian lenny because the gem version 1.2 is too old, an attempt
 update is also failed, any idea?

Several:

1) don't use Debian
2) don't rely on *any* brain-dead, perpetually out-of-date package
management system
3) remove anything ruby/rails-related from your system and install
fresh from source

At least, that's what I would do... :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

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



[Rails] Model validation dependent upon session data being set?

2010-02-27 Thread robo
Ok so I have a few models that need to interact with each other -
Blog, Post, and User.  I'll get their relationships out of the way:

Blog
  has_many :posts
  has_and_belongs_to_many :users (by way of a join table, a blog can
have many contributing users)

Post
  belongs_to :blog
  belongs_to :user (the author of the post)

User
  has_and_belongs_to_many :blogs (a user can contribute to many blogs)
  has_many :posts


I'm running into a problem when validating posts; I want to ensure
that the logged in user we find in the session is listed as a
contributor to the blog they are trying to post to.  I added some
validation to my Post model, that appears to be failing when editing
an existing post.  Post creation, curiously, seems to pass the
validation test.

I should note that @user is a variable set by my ApplicationController
using a before_filter.  really sure what's going on here, so any help
is appreciated.  I'm guessing the @user set by my app controller
probably isn't accessible by the Post class.

Anyhow, here's my Post model:

class Post  ActiveRecord::Base
  belongs_to :blog
  belongs_to :user
  has_many :comments

  validate :user_can_contribute

private
  def user_can_contribute
if @user.nil?
  logger.info(@user hasn't been set yet!)
end

if !blog.users.include?(@user)
  errors.add(:user, You cannot contribute to this blog.)
end
  end
end

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



[Rails] Re: Model validation dependent upon session data being set?

2010-02-27 Thread robo
Actually, I'm not so sure if post creation is passing the validation
test either :)

Sorry for being confusing.

On Feb 27, 11:09 am, robo chase.delanguille...@gmail.com wrote:
 Ok so I have a few models that need to interact with each other -
 Blog, Post, and User.  I'll get their relationships out of the way:

 Blog
   has_many :posts
   has_and_belongs_to_many :users (by way of a join table, a blog can
 have many contributing users)

 Post
   belongs_to :blog
   belongs_to :user (the author of the post)

 User
   has_and_belongs_to_many :blogs (a user can contribute to many blogs)
   has_many :posts

 I'm running into a problem when validating posts; I want to ensure
 that the logged in user we find in the session is listed as a
 contributor to the blog they are trying to post to.  I added some
 validation to my Post model, that appears to be failing when editing
 an existing post.  Post creation, curiously, seems to pass the
 validation test.

 I should note that @user is a variable set by my ApplicationController
 using a before_filter.  really sure what's going on here, so any help
 is appreciated.  I'm guessing the @user set by my app controller
 probably isn't accessible by the Post class.

 Anyhow, here's my Post model:

 class Post  ActiveRecord::Base
   belongs_to :blog
   belongs_to :user
   has_many :comments

   validate :user_can_contribute

 private
   def user_can_contribute
     if @user.nil?
       logger.info(@user hasn't been set yet!)
     end

     if !blog.users.include?(@user)
       errors.add(:user, You cannot contribute to this blog.)
     end
   end
 end

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



Re: [Rails] Model validation dependent upon session data being set?

2010-02-27 Thread Colin Law
On 27 February 2010 17:09, robo chase.delanguille...@gmail.com wrote:
 Ok so I have a few models that need to interact with each other -
 Blog, Post, and User.  I'll get their relationships out of the way:

 Blog
  has_many :posts
  has_and_belongs_to_many :users (by way of a join table, a blog can
 have many contributing users)

 Post
  belongs_to :blog
  belongs_to :user (the author of the post)

 User
  has_and_belongs_to_many :blogs (a user can contribute to many blogs)
  has_many :posts


 I'm running into a problem when validating posts; I want to ensure
 that the logged in user we find in the session is listed as a
 contributor to the blog they are trying to post to.  I added some
 validation to my Post model, that appears to be failing when editing
 an existing post.  Post creation, curiously, seems to pass the
 validation test.

 I should note that @user is a variable set by my ApplicationController
 using a before_filter.  really sure what's going on here, so any help
 is appreciated.  I'm guessing the @user set by my app controller
 probably isn't accessible by the Post class.

 Anyhow, here's my Post model:

 class Post  ActiveRecord::Base
  belongs_to :blog
  belongs_to :user
  has_many :comments

  validate :user_can_contribute

 private
  def user_can_contribute
    if @user.nil?
      logger.info(@user hasn't been set yet!)
    end

    if !blog.users.include?(@user)
      errors.add(:user, You cannot contribute to this blog.)
    end
  end
 end

Have you tried using ruby-debug to break into the validation code and
see what is happening?  See the rails guide on debugging at
http://guides.rubyonrails.org/

Colin

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



[Rails] Re: %= % Interpolation question

2010-02-27 Thread Dudebot
It still displays the literal and not the interpolation :(

On Feb 27, 10:41 am, AGoofin amor...@gmail.com wrote:
 %= bar.to_s %

 On Feb 27, 11:30 am, Dudebot craign...@gmail.com wrote:

  OK, here's what I have in app/views/molds/show.html.erb:

  trtd%= @mold.body.gsub( \n, br / ) %/td/tr

  The controller finds @patient, and @patient.id = 2

  If @mold.body = The patients id is %= @patient.id %

  Then the view displays

  The patients id is %= @patient.id %

  rather than

  The patients id is 2

  Same goes for replacing %= with #{ and % with }

  Many TIA,
  Craig

  On Feb 27, 10:21 am, Craig White craigwh...@azapple.com wrote:

   On Sat, 2010-02-27 at 07:43 -0800, Dudebot wrote:
Thanks, Craig--I think my example was too terse.  What I'm trying to
do is to pass a block of text to a view which may contain multiple
references to external models, and I'd like to interpolate those
references.

So, for example, if @thing.body =  This is the id of foo: %= @foo.id
% and this is its body: %= @foo.body % 

If @foo.id = 2 and @foo.body = Norman, I'd like in the view
whatever.html.erb to have

%= @thing.body %

display

This is the id of foo: 2 and this is its body: Norman

Is there a way to do that?  I also tried #{ ... } and am still getting
the literal rather than the interpolation.

   
   try actual code examples

   Craig

   --
   This message has been scanned for viruses and
   dangerous content by MailScanner, and is
   believed to be clean.

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



Re: [Rails] Re: %= % Interpolation question

2010-02-27 Thread Colin Law
On 27 February 2010 16:30, Dudebot craign...@gmail.com wrote:
 OK, here's what I have in app/views/molds/show.html.erb:

 trtd%= @mold.body.gsub( \n, br / ) %/td/tr

 The controller finds @patient, and @patient.id = 2

 If @mold.body = The patients id is %= @patient.id %

 Then the view displays

 The patients id is %= @patient.id %

 rather than

 The patients id is 2

I don't think many of the readers have actually worked out what you
are asking.  That is, if I am correct, have a string produced by a
controller where the string includes the literal text %= .. % and
have this interpolated somehow in the view.  Perhaps if you were to
explain why you are trying to achieve this someone may suggest a
better way of solving the problem.  Are the strings containing %= ..
% stored in the db for example?

Colin

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send 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 3 - rails runner doesn't work here

2010-02-27 Thread meefs...@googlemail.com
Hi,

I'm currently playing with Rails 3 (I'm new to rails, coming from PHP
background). Everything works good so far, until yesterday, when I
tried to setup a cronjob.

The most common way to starting regular jobs seems to be using rails
runner, right? So, as a test I've created a class Mytest in /vendor/
mytest.rb:

class Mytest
  def self.hello
 hello world
  end
end

Now, when I try to run this method in rails runner like:

shell#  rails runner puts Mytest.hello

I get this response:

== snap ==
/Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/railties-3.0.0.beta/
lib/rails/commands/runner.rb:45: (eval):1: uninitialized constant
Mytest (NameError)
from /Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/
railties-3.0.0.beta/lib/rails/commands.rb:60:in `eval'
from /Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/
railties-3.0.0.beta/lib/rails/commands/runner.rb:45
from /Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/
railties-3.0.0.beta/lib/rails/commands.rb:60:in `require'
from /Users/christian/.rvm/gems/ruby-1.8.7-p249/gems/
railties-3.0.0.beta/lib/rails/commands.rb:60
from /private/tmp/testapp/script/rails:10:in `require'
from /private/tmp/testapp/script/rails:10
==

I was wondering if I did something wrong. So I checked the same stuff
in Rails 2 on another machine. The same call ./script/runner puts
Mytest.hello works there.

I did some other test, but the rails runner script seems to throw this
error on other things too (like, when I created a simple model and try
to do rails runner User.new).

The same call in rails console does work (in case of puts
Mytest.hello prints hello world).

Is this a bug in Rails 3? I'm using rvm and tried with serveral ruby
versions (ruby 1.8.7.p29, ruby 1.9.1.p378 and ruby 1.9.2-preview1 and
ruby-head). Rails is 3.0.0.beta

Any ideas? Did I forget something here (beginner mistake), or is this
a (known) bug?

Regards,
Christian

P.S: I've found several ways to working with cron/background jobs with
Rails, like rake, background-rb, rails-runner or delayed_jobs. Is
there any recommended way to do this in Rails 3? I'm just wondering
because I feel cronjobs are a common task in web development, and
usually Rails does have a 'recommendation' for common taks. :-)



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



[Rails] Paperclip upload fails sometimes

2010-02-27 Thread @shaan
Hello,

My application is a rails-postgresql application which uses paperclip
(ImageMagick-6.5.4-10-Q16-windows-dll.exe installed on WinXP).

The application's image uploading feature works consistently right on
my development PC, however it is inconsistent on a different server PC
(used for deployment).

There are certain observations below.

a) For the first time the file gets uploaded right.
b) The same file if attempted for again, twice, thrice, gets uploaded
right.
c) At the fourth time (may not necessarily be at the fourth time, but
often it is), it fails with this error - C:/./stream.1644.0 is not
recognized by the 'identify' command.
d) This happens with any file as such and the file is not at fault.
e) Some time after the occurrence of this error, I attempted again (w/
o restarting my web server), it worked! But again in the next attempt
- the same error gets shown. Then again, it worked.
f) There is a slightly uncertain behavior with this upload - it works
if tried again (may be after some time).
g) However, on my development PC, this is not the case. It works right
consistently.

The a few people have been saying that the cause of this error could
be that the path to Imagemagick - identify.exe is incorrectly set.
But, then the image upload works as well (can work right only if the
path is correct) - so I do not suspect it to be a path problem.

Request any possible help with this situation. Thanks in advance.

love-n-peace,
@shaan
'Aal izz well' shaan

Posts: 5
Joined: 2010-02-24T08:33:52+00:00
Private message

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



[Rails] Re: %= % Interpolation question

2010-02-27 Thread Dudebot
Thanks, Colin!  I'd like to give the user the flexibility to make a
template that interpolates objects within it.  Sort of like a mail
merge.  The templates are stored as text entries in a database.  The
idea is, say you have something like this as a text entry in the
database

Dear Mr. %= @person.lastname %,
We understand that your favorite programming language is %=
@person.language %.

Then, if the user was accessing the person show form for @person 2
with lastname Smith and language Ruby, it would display

Dear Mr. Smith,
We understand that your favorite programming language is Ruby.

I am so open to ideas :)  Right now I'm imagining building an XML
parser, and identifying the fields as tags, then replacing them with
the appropriate objects, but I was wondering if there was a more
direct (or better) way.

Again, thanks,
Craig

On Feb 27, 11:43 am, Colin Law clan...@googlemail.com wrote:
 On 27 February 2010 16:30, Dudebot craign...@gmail.com wrote:

  OK, here's what I have in app/views/molds/show.html.erb:

  trtd%= @mold.body.gsub( \n, br / ) %/td/tr

  The controller finds @patient, and @patient.id = 2

  If @mold.body = The patients id is %= @patient.id %

  Then the view displays

  The patients id is %= @patient.id %

  rather than

  The patients id is 2

 I don't think many of the readers have actually worked out what you
 are asking.  That is, if I am correct, have a string produced by a
 controller where the string includes the literal text %= .. % and
 have this interpolated somehow in the view.  Perhaps if you were to
 explain why you are trying to achieve this someone may suggest a
 better way of solving the problem.  Are the strings containing %= ..
 % stored in the db for example?

 Colin

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



[Rails] automatic link generator based on keyword

2010-02-27 Thread Dan Paul
Hello,

I have an site similar to a wiki, where there is a lot of content
displayed per page.  I was wondering if there was a plugin that would
automatically add link_to tags on keywords that I specified and link
them to the pages that I specify.  For example the plugin I would
identify the keywords and links first;

keyword = Printer zxy
link = /product/printer-zxy

and then it would automatically fill in all the proper links if that
keyword is displayed in a specified area, like the product
description.  I have searched but have not found anything.  If anyone
has come across a rails plugin that automatically generates links
based on keywords I would greatly appreciate if you shared it.  If not
I might just have to write something up.  Thanks in advance.

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



[Rails] Re: Inconsistent auto generated fixture IDs

2010-02-27 Thread Matt Jones


On Feb 26, 12:23 pm, Frederick Cheung frederick.che...@gmail.com
wrote:
 On Feb 26, 4:17 pm, blim8183 blim8...@gmail.com wrote:

  I'm having an issue where the auto generated IDs in the fixtures are
  inconsistent from my machine to that of the other developers working
  on the project. The main difference between between the machines is
  that I'm running Snow Leopard and I think everyone else is on
  Leopard.

  We're using factories to generate the fixtures so I don't know what
  label Rails is hashing to auto generate the ID.

  Any help in debugging this would be greatly appreciated. Thanks in
  advance.

 In previous versions of rails the autogenerated fixture is (basically)
 just the hash of the label (as in foo.hash).
 The hash method is not guaranteed to be the same across different
 versions or builds of ruby, in particular 64 bit versions are
 different to 32bit (and in snow leopard ruby is a 64 bit app). Later
 versions of rails (don't remember the first) use a crc32, so that
 should be stable across different builds of ruby

 I'm not sure why you care though

Exactly - the whole point of the auto-generated ids is to do things
like this in the fixture:

author: somebody

Which references the *name* of the desired author fixture rather than
the id.

--Matt Jones

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



[Rails] Re: Can a server make a post to itself?

2010-02-27 Thread Matt Jones


On Feb 26, 2:29 pm, dino d. dinodorr...@yahoo.com wrote:
 Hi-

 I have a rails app where a form gets submitted, and that data from the
 form has to be validated.  It's a widget app, so other sites will use
 the validation routine, but I also want to use it myself, from the
 same server that does the validation.  So, is it possible for a ruby
 instance to send a post to the same server?  I try this in development
 but it freezes up and I eventually get a timeout error.  The code
 looks like this:

 def verify_home
     @response = An error has occurred.
     if params[:widget_id] and params[:widget_answer]
       result = Net::HTTP.post_form(URI.parse('http://localhost:3000/
 questions/verify'),
         {'widget_id' = params[:widget_id], 'widget_answer' =
 params[:widget_answer])
       if result.include? success
         @response = Correct!
       end
     end
     redirect_to :action = index
   end

 So, the questions/verify method works just fine on its own (when
 submitted from a different site), but freezes up when I send it from
 the current server to itself.

You're probably better off just calling the model method that
questions/verify calls - you could even refactor the parameter parsing
into a method on ApplicationController if verify_home isn't in the
same class.

--Matt Jones

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



[Rails] Re: Paperclip upload fails sometimes

2010-02-27 Thread Fernando Perez
I am experiencing great problems uploading with Safari. Which browser 
are you using?
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email 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 3 on debian

2010-02-27 Thread Fernando Perez
 1) don't use Debian
 2) don't rely on *any* brain-dead, perpetually out-of-date package
 management system
 3) remove anything ruby/rails-related from your system and install
 fresh from source
 
 At least, that's what I would do... :-)
 
 --
 Hassan Schroeder  hassan.schroe...@gmail.com
 twitter: @hassan

Yes, Rubygems must be installed from source. Depending on your tastes, 
Ruby can also be installed from source.

Disregard 1  2 as they are just trolls.
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Postgresql error in connecting to database - invalid response to ssl negotiation

2010-02-27 Thread Fernando Perez
Why SSL? DB and application are on different machines?
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Desktop sharing software for linux fedora 10?

2010-02-27 Thread Fernando Perez
shyam mohan wrote:
 HI all
 please tell me if there in any
 Desktop sharing software for linux fedora 10?
What for? Free or commercial?
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: %= % Interpolation question

2010-02-27 Thread Craig White
On Sat, 2010-02-27 at 10:12 -0800, Dudebot wrote:
 Thanks, Colin!  I'd like to give the user the flexibility to make a
 template that interpolates objects within it.  Sort of like a mail
 merge.  The templates are stored as text entries in a database.  The
 idea is, say you have something like this as a text entry in the
 database
 
 Dear Mr. %= @person.lastname %,
 We understand that your favorite programming language is %=
 @person.language %.
 
 Then, if the user was accessing the person show form for @person 2
 with lastname Smith and language Ruby, it would display
 
 Dear Mr. Smith,
 We understand that your favorite programming language is Ruby.
 
 I am so open to ideas :)  Right now I'm imagining building an XML
 parser, and identifying the fields as tags, then replacing them with
 the appropriate objects, but I was wondering if there was a more
 direct (or better) way.

I think you need to start with another rails beginner tutorial because
this is very beginner stuff and easily accomplished just as you said and
without any need for xml parsers or sophisticated methods at all.

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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



Re: [Rails] Desktop sharing software for linux fedora 10?

2010-02-27 Thread Craig White
On Sat, 2010-02-27 at 11:42 +0530, shyam mohan wrote:
 HI all
 please tell me if there in any
 Desktop sharing software for linux fedora 10?

Fedora 10 is End of Life and should be upgraded.

VNC and FreeNX are both available from yum installs.

I suggest FreeNX but only after you upgrade to a current version.

This has nothing to do with Ruby on Rails.

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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



Re: [Rails] Re: rails 3 on debian

2010-02-27 Thread Hassan Schroeder
On Sat, Feb 27, 2010 at 10:40 AM, Fernando Perez li...@ruby-forum.com wrote:

 Disregard 1  2 as they are just trolls.

Au contraire - I see so many cases of people struggling with problems
directly caused by the Debian way of packaging 3rd-party software
(not just Ruby-related).

The OP's problem is exactly that; pointing it out is hardly a troll.

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

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



[Rails] Re: %= % Interpolation question

2010-02-27 Thread Dudebot
I'm no expert at Rails, Craig, but I've been writing working Rails
code for about 8 months now on more than a few projects.  I've read
Agile Development more than once, and have over the course of time
watched scores of Rails webcasts.

If you have a solution to my question, I'd appreciate it.  I don't
think you understand the question.  I need the user to generate their
own templates.  If I was hard coding all the templates for them, this
would be cake.

On Feb 27, 12:47 pm, Craig White craigwh...@azapple.com wrote:
 On Sat, 2010-02-27 at 10:12 -0800, Dudebot wrote:
  Thanks, Colin!  I'd like to give the user the flexibility to make a
  template that interpolates objects within it.  Sort of like a mail
  merge.  The templates are stored as text entries in a database.  The
  idea is, say you have something like this as a text entry in the
  database

  Dear Mr. %= @person.lastname %,
  We understand that your favorite programming language is %=
  @person.language %.

  Then, if the user was accessing the person show form for @person 2
  with lastname Smith and language Ruby, it would display

  Dear Mr. Smith,
  We understand that your favorite programming language is Ruby.

  I am so open to ideas :)  Right now I'm imagining building an XML
  parser, and identifying the fields as tags, then replacing them with
  the appropriate objects, but I was wondering if there was a more
  direct (or better) way.

 
 I think you need to start with another rails beginner tutorial because
 this is very beginner stuff and easily accomplished just as you said and
 without any need for xml parsers or sophisticated methods at all.

 Craig

 --
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.

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



Re: [Rails] Model validation dependent upon session data being set?

2010-02-27 Thread Michael Pavling
On 27 February 2010 17:09, robo chase.delanguille...@gmail.com wrote:
 I should note that @user is a variable set by my ApplicationController
 using a before_filter.  really sure what's going on here, so any help
 is appreciated.  I'm guessing the @user set by my app controller
 probably isn't accessible by the Post class.

Yup - you've identified your problem perfectly... here's a suggested solution:

@user is a instance variable; that is, only available to the instance
of a class (in this instance, the controller). So you can't access it
from an instance of a different class.
So you need to create a method on your controller that will return the
@user object. The convention for this method seems to be to call it
current_user.

def current_user
  @user
end

Simple, huh? ;-)
Now you can get rid of that before_filter call, and do the operation
when/if somewhere calls current_user - so it'll look more like this:

def current_user
  @user ||= the_method_for_the_logic_that_works_out_the_logged_in_user
end


An other solution would be to use a wrapped-up plugin to do
authentication (there are lots to choose from), which would take all
you user/password management woes and deal with them for you (and most
likely give you a current_user method!)

HTH
Michael

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



Re: [Rails] Model validation dependent upon session data being set?

2010-02-27 Thread Michael Pavling
On 27 February 2010 19:24, Michael Pavling pavl...@gmail.com wrote:
 So you need to create a method on your controller that will return the
 @user object. The convention for this method seems to be to call it
 current_user.


*ahem*  Of course... an instance of a model doesn't have access to
application_controller's methods... I was getting carried away with
myself.
You will *also* need to pass this to the Post directly... so declare
an attr_writer :current_user on your Post model, and in the
controller, when you instanciate the Post, pass it the variable:

post = Post.find(params[:post_id] # or whatever...
post.current_user = current_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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] DRY question

2010-02-27 Thread Dudebot
I need to have the exact same method available in all controllers and
in all views.  Right now, I have it repeated in app/controllers/
application_controller.rb and app/helpers/application_helper.rb.  In
DRY tradition, what's the best way to only have it in one place?
TIA,
Craig

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



Re: [Rails] DRY question

2010-02-27 Thread ben wiseley
Just put it in a helper and include that helper in ApplicationController
like this

include MyHelperWithGlobalStuffInIt

On Sat, Feb 27, 2010 at 3:08 PM, Dudebot craign...@gmail.com wrote:

 I need to have the exact same method available in all controllers and
 in all views.  Right now, I have it repeated in app/controllers/
 application_controller.rb and app/helpers/application_helper.rb.  In
 DRY tradition, what's the best way to only have it in one place?
 TIA,
 Craig

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



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



[Rails] Re: Model validation dependent upon session data being set?

2010-02-27 Thread robo
Hey, that did the trick.  Thanks for that!

On Feb 27, 1:36 pm, Michael Pavling pavl...@gmail.com wrote:
 On 27 February 2010 19:24, Michael Pavling pavl...@gmail.com wrote:

  So you need to create a method on your controller that will return the
  @user object. The convention for this method seems to be to call it
  current_user.

 *ahem*  Of course... an instance of a model doesn't have access to
 application_controller's methods... I was getting carried away with
 myself.
 You will *also* need to pass this to the Post directly... so declare
 an attr_writer :current_user on your Post model, and in the
 controller, when you instanciate the Post, pass it the variable:

 post = Post.find(params[:post_id] # or whatever...
 post.current_user = current_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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: DRY question

2010-02-27 Thread Dudebot
On Feb 27, 5:10 pm, ben wiseley wisel...@gmail.com wrote:
 Just put it in a helper and include that helper in ApplicationController
 like this

 include MyHelperWithGlobalStuffInIt

You're right, putting

include ApplicationHelper

into application_controller.rb does the trick.

But wasn't that what

helper :all # include all helpers, all the time

was supposed to do?

Or do I misunderstand?

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email 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 3 - rails runner doesn't work here

2010-02-27 Thread meefs...@googlemail.com

Hm, seems to be a problem in the older rails beta (the one you install
with 'gem install rails --pre').
With rails -v = Rails 3.0.0.beta1 the error disappears ;-)

Regards
Christian

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



[Rails] SEO friendly routing

2010-02-27 Thread Vadim Sigaev
Hi all!

I'm moving to Ruby on Rails from PHP/ZendFramework. And i cannot
understand how to make such routing model:

I am trying to develop articles site from scratch, so i have article
model with fields: id, title, section, alias and body, also i have
sections tree for navigation, each section has fields: id, parent_id,
title, alias.

I want to have each article have path like
{root_section_alias}/{subsection_alias}/{article_alias}

Example urls:

http://localhost/news/spb/ramstain-rullezz
http://localhost/humor/some-humor-article

--
Excuse for my bad English
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send 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 Server Failing - No such file or directory - tmp/pids/server.pid

2010-02-27 Thread Merrick Christensen
I apologize for my stupidity. I've been running rails on this machine
for a few months. I have upgraded to Ruby on Rails 3 to start playing
around. When running the rails server I get the following output.
Any help is much appreciated.

I installed Rails 3 very easily on my box at work. But here, not so
much. It's been a few hours, I can't talk in IRC - not sure why.
Getting frustrated with myself.

Thanks for any help in advance!

merrick-christensens-mac-pro:campaignarkitekt.com Merrick$ rails
server
= Booting WEBrick
= Rails 3.0.0.beta application starting in development on http://0.0.0.0:3000
= Call with -d to detach
= Ctrl-C to shutdown server
Exiting
/opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:208:in
`initialize': No such file or directory - tmp/pids/server.pid
(Errno::ENOENT)
from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:
208:in `open'
from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:
208:in `write_pid'
from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:
154:in `start'
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/
commands/server.rb:49:in `start'
from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:
83:in `start'
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/
commands.rb:39
from /Users/Merrick/Work/Arkitekt/Projects/Campaign Arkitekt/
campaignarkitekt.com/script/rails:10:in `require'
from /Users/Merrick/Work/Arkitekt/Projects/Campaign Arkitekt/
campaignarkitekt.com/script/rails:10

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



[Rails] Persistent Sessions

2010-02-27 Thread Michael Murillo
Hi there,

I am trying to figure out how to have persistent sessions (with like a
month until expiration) for my users, sort of like a remember me
functionality but that is handled automatically on login.  I am hoping I
can get some help from someone who is more experienced with Rails.

I am currently using a controller called Sessions to handle my session
properties.

This is what my controller looks like.

def create
@current_user = User.find_by_login_and_password(
params[:login], params[:password])

if @current_user
  session[:user_id] = @current_user.id
  if session[:return_to]
redirect_to session[:return_to]
session[:return_to] = nil
  else
redirect_to links_path
  end
else
  render :action = 'new'
end
  end

  def destroy
session[:user_id] = @current_user = nil
  end

I have surfed around the internet looking for solutions but their is no
real consistent method out there.  Everyone seems to have a different
opinion on how to manage sessions/cookies.  I am hoping to not have to
change my controller structure (by say installing a plug-in) and
sticking with Sessions creation.

Thank you in advance.
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: SEO friendly routing

2010-02-27 Thread Sohan
Try the plugin at http://github.com/smsohan/acts_as_permalinkable

On Feb 27, 7:37 pm, Vadim Sigaev li...@ruby-forum.com wrote:
 Hi all!

 I'm moving to Ruby on Rails from PHP/ZendFramework. And i cannot
 understand how to make such routing model:

 I am trying to develop articles site from scratch, so i have article
 model with fields: id, title, section, alias and body, also i have
 sections tree for navigation, each section has fields: id, parent_id,
 title, alias.

 I want to have each article have path like
 {root_section_alias}/{subsection_alias}/{article_alias}

 Example urls:

 http://localhost/news/spb/ramstain-rullezzhttp://localhost/humor/some-humor-article

 --
 Excuse for my bad English
 --
 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-t...@googlegroups.com.
To unsubscribe from this group, send email 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 3 on debian

2010-02-27 Thread Ken Paul

 
 Yes, Rubygems must be installed from source. Depending on your tastes, 
 Ruby can also be installed from source.
 
 Disregard 1  2 as they are just trolls.

what about ubuntu Linux, does it also provide out dated rails related 
resources?
-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Persistent Sessions

2010-02-27 Thread Conrad Taylor



Sent from my iPhone

On Feb 27, 2010, at 7:16 PM, Michael Murillo li...@ruby-forum.com  
wrote:



Hi there,

I am trying to figure out how to have persistent sessions (with like a
month until expiration) for my users, sort of like a remember me
functionality but that is handled automatically on login.  I am  
hoping I

can get some help from someone who is more experienced with Rails.

I am currently using a controller called Sessions to handle my  
session

properties.

This is what my controller looks like.

def create
   @current_user = User.find_by_login_and_password(
   params[:login], params[:password])

   if @current_user
 session[:user_id] = @current_user.id
 if session[:return_to]
   redirect_to session[:return_to]
   session[:return_to] = nil
 else
   redirect_to links_path
 end
   else
 render :action = 'new'
   end
 end

 def destroy
   session[:user_id] = @current_user = nil
 end

I have surfed around the internet looking for solutions but their is  
no

real consistent method out there.  Everyone seems to have a different
opinion on how to manage sessions/cookies.  I am hoping to not have to
change my controller structure (by say installing a plug-in) and
sticking with Sessions creation.

Thank you in advance.


Michael, I would recommend using Authlogic because it has a method,  
remember_me_for, that one can redefine in the user_session model to  
set the duration of time.


Good luck,

-Conrad


--
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- 
t...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en 
.




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



Re: [Rails] Re: DRY question

2010-02-27 Thread ben wiseley
I've wondered about that too.  That doesn't work for me either.   It doesn't
raise an error but doesn't include :all either.

On Sat, Feb 27, 2010 at 4:38 PM, Dudebot craign...@gmail.com wrote:

 On Feb 27, 5:10 pm, ben wiseley wisel...@gmail.com wrote:
  Just put it in a helper and include that helper in ApplicationController
  like this
 
  include MyHelperWithGlobalStuffInIt
 
 You're right, putting

 include ApplicationHelper

 into application_controller.rb does the trick.

 But wasn't that what

 helper :all # include all helpers, all the time

 was supposed to do?

 Or do I misunderstand?

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



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



[Rails] Re: Please Help: Accessing Ruby app brings up Apache test page

2010-02-27 Thread rezilient
Oh, yes it is colon in the actual httpd.conf, I typo'd when I was
removing my actual IP address.  The website is accessible without
problems, except Ruby is not loading up.

Is there any way I can test if Ruby is indeed installed correctly?
What could I be missing?

Thanks.



On Feb 27, 7:02 am, Simon Macneall macne...@gmail.com wrote:
 Shouldn't the virtual host be

 VirtualHost 69.69.69.169:80

 Note the colon?

 Cheers
 Simon

 On Sat, 27 Feb 2010 16:22:20 +0800, rezilient rezili...@gmail.com wrote:
  Any ideas?  Thanks for any advice.

  On Feb 25, 9:09 pm, rezilient rezili...@gmail.com wrote:
  Hello.

  I finally got Ruby, Gem and Passenger installed without any glaring
  errors.

  ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux]
  gem 1.3.5

  I added the following lines to my httpd.conf:

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

  (confirmed the files/folders are present)

  and for the virtual host we have:

  VirtualHost 69.69.69.169.80
  SuexecUserGroup #528 #529
  ServerName clockingit.mywebsite.com
  ServerAliaswww.clockingit.mywebsite.com
  ServerAlias webmail.clockingit.mywebsite.com
  ServerAlias admin.clockingit.mywebsite.com
  DocumentRoot /home/mywebsite/domains/clockingit.mywebsite.com/
  clockingit/public
  ErrorLog /var/log/virtualmin/clockingit.mywebsite.com_error_log
  CustomLog /var/log/virtualmin/clockingit.mywebsite.com_access_log
  combined
  #ScriptAlias /cgi-bin/ /home/mywebsite/domains/
  clockingit.mywebsite.com/cgi-bin/
  #ScriptAlias /awstats /home/mywebsite/domains/clockingit.mywebsite.com/
  cgi-bin
  #DirectoryIndex index.html index.htm index.php index.php4 index.php5
  Directory /home/mywebsite/domains/clockingit.mywebsite.com/clockingit/
  public
  Options -Indexes FollowSymLinks -MultiViews
  allow from all
  AllowOverride All
  RailsEnv production
  PassengerHighPerformance on
  /Directory
  #Directory /home/mywebsite/domains/clockingit.mywebsite.com/cgi-bin
  #allow from all
  #/Directory
  #RewriteEngine on
  #RewriteCond %{HTTP_HOST} =webmail.clockingit.mywebsite.com
  #RewriteRule ^(.*)https://clockingit.mywebsite.com:2/[R]
  #RewriteCond %{HTTP_HOST} =admin.clockingit.mywebsite.com
  #RewriteRule ^(.*)https://clockingit.mywebsite.com:1/[R]
  #Files awstats.pl
  #AuthName clockingit.mywebsite.com statistics
  #AuthType Basic
  #AuthUserFile /home/mywebsite/domains/
  clockingit.mywebsite.com/.awstats-htpasswd
  #require valid-user
  #/Files
  #Alias /dav /home/mywebsite/domains/clockingit.mywebsite.com/
  clockingit/public
  #Location /dav
  #DAV On
  #AuthType Basic
  #AuthName clockingit.mywebsite.com
  #AuthUserFile /home/mywebsite/domains/clockingit.mywebsite.com/etc/
  dav.digest.passwd
  #Require valid-user
  #ForceType text/plain
  #Satisfy All
  #/Location
  /VirtualHost

  A lot of the stuff I commented out above came from Virtualmin so I cut
  it down to the basics that Passenger guide suggested.

  When I hit the site I am getting the default Apache 2 Test Page.
  When I put a test index.html in public for this app (the app is
  called clockingIT) the index.html is loading as expected, as if Ruby
  doesn't exist.

  So I'm guessing something is missing.. How can I check if Passenger is
  loaded correctly?  I don't get any errors when I start Apache, so...

  Thanks for any help!!

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



Re: [Rails] Re: Please Help: Accessing Ruby app brings up Apache test page

2010-02-27 Thread Simon Macneall

I'd cd into your app dir and run
ruby script/server
then try to hit your app on port 3000, if that works, rails is set up ok  
and it's your apache/passenger setup that is wrong



On Sun, 28 Feb 2010 14:20:51 +0800, rezilient rezili...@gmail.com wrote:


Oh, yes it is colon in the actual httpd.conf, I typo'd when I was
removing my actual IP address.  The website is accessible without
problems, except Ruby is not loading up.

Is there any way I can test if Ruby is indeed installed correctly?
What could I be missing?

Thanks.



On Feb 27, 7:02 am, Simon Macneall macne...@gmail.com wrote:

Shouldn't the virtual host be

VirtualHost 69.69.69.169:80

Note the colon?

Cheers
Simon

On Sat, 27 Feb 2010 16:22:20 +0800, rezilient rezili...@gmail.com  
wrote:

 Any ideas?  Thanks for any advice.

 On Feb 25, 9:09 pm, rezilient rezili...@gmail.com wrote:
 Hello.

 I finally got Ruby, Gem and Passenger installed without any glaring
 errors.

 ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux]
 gem 1.3.5

 I added the following lines to my httpd.conf:

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

 (confirmed the files/folders are present)

 and for the virtual host we have:

 VirtualHost 69.69.69.169.80
 SuexecUserGroup #528 #529
 ServerName clockingit.mywebsite.com
 ServerAliaswww.clockingit.mywebsite.com
 ServerAlias webmail.clockingit.mywebsite.com
 ServerAlias admin.clockingit.mywebsite.com
 DocumentRoot /home/mywebsite/domains/clockingit.mywebsite.com/
 clockingit/public
 ErrorLog /var/log/virtualmin/clockingit.mywebsite.com_error_log
 CustomLog /var/log/virtualmin/clockingit.mywebsite.com_access_log
 combined
 #ScriptAlias /cgi-bin/ /home/mywebsite/domains/
 clockingit.mywebsite.com/cgi-bin/
 #ScriptAlias /awstats  
/home/mywebsite/domains/clockingit.mywebsite.com/

 cgi-bin
 #DirectoryIndex index.html index.htm index.php index.php4 index.php5
 Directory  
/home/mywebsite/domains/clockingit.mywebsite.com/clockingit/

 public
 Options -Indexes FollowSymLinks -MultiViews
 allow from all
 AllowOverride All
 RailsEnv production
 PassengerHighPerformance on
 /Directory
 #Directory /home/mywebsite/domains/clockingit.mywebsite.com/cgi-bin
 #allow from all
 #/Directory
 #RewriteEngine on
 #RewriteCond %{HTTP_HOST} =webmail.clockingit.mywebsite.com
 #RewriteRule ^(.*)https://clockingit.mywebsite.com:2/[R]
 #RewriteCond %{HTTP_HOST} =admin.clockingit.mywebsite.com
 #RewriteRule ^(.*)https://clockingit.mywebsite.com:1/[R]
 #Files awstats.pl
 #AuthName clockingit.mywebsite.com statistics
 #AuthType Basic
 #AuthUserFile /home/mywebsite/domains/
 clockingit.mywebsite.com/.awstats-htpasswd
 #require valid-user
 #/Files
 #Alias /dav /home/mywebsite/domains/clockingit.mywebsite.com/
 clockingit/public
 #Location /dav
 #DAV On
 #AuthType Basic
 #AuthName clockingit.mywebsite.com
 #AuthUserFile /home/mywebsite/domains/clockingit.mywebsite.com/etc/
 dav.digest.passwd
 #Require valid-user
 #ForceType text/plain
 #Satisfy All
 #/Location
 /VirtualHost

 A lot of the stuff I commented out above came from Virtualmin so I  
cut

 it down to the basics that Passenger guide suggested.

 When I hit the site I am getting the default Apache 2 Test Page.
 When I put a test index.html in public for this app (the app is
 called clockingIT) the index.html is loading as expected, as if Ruby
 doesn't exist.

 So I'm guessing something is missing.. How can I check if Passenger  
is

 loaded correctly?  I don't get any errors when I start Apache, so...

 Thanks for any help!!




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



[Rails] Couldn't find User without an ID

2010-02-27 Thread ashu
users_controller :--

 def show
@user = User.find(params[:id])
  end

show.html.erb :--

h1Showing user/h1
pthName/th: %=h @user.name%/p
pthRole/th: %=h @user.role%/p
pthPassword/th: %=h @user.password%/p
pthConfirmation Password/th: %=h @user.confirmation_password%/
p
%= link_to 'Back', :action ='list' %

Error :
 ActiveRecord::RecordNotFound in UsersController#show

Couldn't find User without an ID
 Please help it must help full for edti.html.erb

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