Ruby on Rails Tuesday, August 31, 2010

Bharat Ruparel wrote:
> Thank you for your time. This makes sense. However, there is not a
> single place in my application where I am calling save(false) and this
> warning is triggered all over the place WITHOUT a reference to the line
> of code (in the plugin/gem) that might be triggering it.
>
> I have simply commented it out in the rails 3.0 code since in my
> judgement, it is more trouble than worth it?
>
> What do you think?
>
> Bharat

The "head in the sand" approach isn't usually a good one, but I can
understand your frustration at all of the Deprecation warnings. If you
aren't using it then it is certainly a gem or plugin, and with Rails 3
officially out they will be updated shortly. If they aren't actively
updated you should investigate another solution anyhow =)
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Fritz Trapper wrote:
> Robert Walker wrote:
>> If you just want to see what routes you have defined.
>
> No, I want to know, which parameters and options are acceptet.

Did you read that guide I linked? It should tell you all you need to
know about using the routing helpers.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

They make Navicat for MySQL too. I love it, couldn't do without it.

That being said, if you really can't tell the difference between PGSQL
and MySQL then you're probably better off with MySQL :)

Most developers make the switch to PG because they realize they need
more advanced DBA features that MySQL doesn't offer. If you're not
missing these features, why bother?

My $0.02.

*Cue PG fan trashing MySQL based on technical merits here*

--------------------
http://subimage.com
http://twitter.com/subimage

On Tue, Aug 31, 2010 at 5:43 PM, Christian Fazzini
<christian.fazzini@gmail.com> wrote:
> Just thinking out loud. about switching from pgsql to mysql. So far,
> haven't experienced any differences between the two databases. I've
> been using mysql for the past few years. I like it more because am a
> mac interface junkie and mysql has sequel pro. Not that this is a
> determining factor. But pgsql also has navicat (in my opinion, not as
> good as sequel pro).
>
> The more important thing is, web hosts that I have spoken to have said
> that pgsql takes up a considerable amount of RAM than mysql... More
> RAM on a web host means more $$$.
>
> Moreover, since I've switched from Symfony PHP. Most of my other web
> projects will be hosted with a mysql db.
>
> I am sure there may be other more significant differences. But for my
> every day use as a web developer, I don't really notice the internal
> features that pgsql has over mysql.
>
> What are you thoughts
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Just thinking out loud. about switching from pgsql to mysql. So far,
haven't experienced any differences between the two databases. I've
been using mysql for the past few years. I like it more because am a
mac interface junkie and mysql has sequel pro. Not that this is a
determining factor. But pgsql also has navicat (in my opinion, not as
good as sequel pro).

The more important thing is, web hosts that I have spoken to have said
that pgsql takes up a considerable amount of RAM than mysql... More
RAM on a web host means more $$$.

Moreover, since I've switched from Symfony PHP. Most of my other web
projects will be hosted with a mysql db.

I am sure there may be other more significant differences. But for my
every day use as a web developer, I don't really notice the internal
features that pgsql has over mysql.

What are you thoughts

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

Ruby on Rails

Robert Walker wrote:
> If you just want to see what routes you have defined.

No, I want to know, which parameters and options are acceptet.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Msan Msan wrote:
> Ok to not depend on a specific javascript framework but now its' hard
> for me to reproduce the same behavior of some helpers like
> observe_field.
> I've found some jquery examples but all use the event change that is
> triggered only when the text field loses focus.
> It's not the same behavior as observe_field.
> There is someone in the same situation?

Unobtrusive JavaScript and JavaScript agnosticism are really two
separate and unrelated issues.

Unobtrusive JavaScript is the "new hotness" because from a design
standpoint it makes a lot of sense. From what I can gather it seems that
most developers are trending away from the built-in helpers and doing
more with pure JavaScript.

I've not worked with Rails 3's unobtrusive JavaScript to know the issues
involved. Bu, I do use unobtrusive techniques wherever possible, which
seems to be pretty much everywhere.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

On Tue, Aug 31, 2010 at 3:23 PM, Marnen Laibow-Koser
<lists@ruby-forum.com> wrote:
> Interesting.  When I chose between Debian and Ubuntu about 4 years ago,
> part of my reason for choosing Ubuntu was reading that Ubuntu's package
> management was *more conservative* than Ubuntu's, and that as a result
> Ubuntu packages were *more stable* than Debian packages.  Did something
> change in those 4 years?
>
> (I've used both Debian and Ubuntu in that time and not noticed much
> difference.)

Well.. in the 12 years I've been using Debian, it has never once left
me with an un-bootable system. The software is frozen for several
months before a stable distro is released, and then updates only
contain security fixes, not new features. The only thing I've ever
found more stable than Debian is BSD, FreeBSD in particular has been
rock solid for me over the years. I usually use FreeBSD (or OpenBSD
if my hardware supports it) for my firewall servers where I don't even
trust Linux.

Ubuntu provides me with bleeding edge new versions of everything, just
like you would want for a modern desktop, but in turn has left me with
an un-bootable system many times. Their recent choice to go ahead
with Grub 2.0, for example, took down 5 developer machines where I
work a few months back.. and that was the 10.04 LTS distro that is
supposed to be long-term stable.

I've never once had to "fix" a Debian system after performing updates.
Ubuntu I've fixed more times that I can count.

I'm sure everyone's experience varies, but mine has been that Ubuntu
has much newer versions, and as a result is less stable than Debian
overall.


--
Greg Donald
destiney.com | gregdonald.com

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

Ruby on Rails

>> Rails automatically appends a dummy date when you use the TIME type on
>> your database. My point is: if you are using a time data type on your
>> database, you are doing that exactly because you don't want the date
>> included.
>>
>> Anyway, I am storing a integer column with the total seconds on the
>> database and then transforming that with composed_of. Is there a
>> better way to do that? Anyone know if there is a gem or something to
>> handle cases like these?
>
> Time without date is useless and extremely prone to error. Internally
> time is stored as millisecond offsets from a reference date (e.g. UNIX
> time is the number of milliseconds from midnight January 1, 1970 UTC).
> The date and time related objects in Ruby depend on this underlying
> offset.
>
> a value of 14:00 is meaningless without relating that to some date, in
> some time zone, and applying the geopolitical rules for daylight savings
> (or other adjustments to the normal flow of time).

Just for the sake of argument... how about the time it takes runners to finish a marathon? Sure you could use seconds as an integer field, but time without date make sense...

I agree that "4pm" is kind of pointless, but "16 hours" can be handy.

If only to save me from having to convert from seconds to hh:mm:ss and back, etc...

-philip

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

Ruby on Rails

Fritz Trapper wrote:
> Rails is able to dynamically build methods from magic names like
> edit_record_path.
>
> This is very powerful, but how to find docs about it?

http://guides.rubyonrails.org/routing.html

If you just want to see what routes you have defined.

$ rake routes
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Marnen Laibow-Koser wrote:
> Frank Burleigh wrote:
>> I've always distrusted the ruby and rails installs on my Mac (oOS X
>> 10.6.3) --
[...]

Sorry, neglected to notice I was replying to an oldish post.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Frank Burleigh wrote:
> I've always distrusted the ruby and rails installs on my Mac (oOS X
> 10.6.3) --

I've noticed this distrust in a lot of people. Can't see any reason for
it myself. Apple's Ruby has always worked fine for me. I'll be
installing 1.9.2 and RVM at some point, but until then I'll save my
effort and disk space and not build my own Ruby. If that costs me geek
brownie points, so be it. :D.

> sudo gem cleanup can't seem to get rid of old gem versions
> (lots of Gem::InstallError: cannot uninstall).

Never seen that. Find and fix the problem instead of just "distrusting"
your development environment.

Again: Apple's Ruby is perfectly trustworthy. If it's not working for
you, the problem is most likely elsewhere (perhaps a reinstallation of
Apple's dev tools is in order...).

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Greg Donald wrote:
> On Tue, Aug 31, 2010 at 1:01 PM, Brad Lindsay <brad.lindsay@gmail.com>
> wrote:
>> Yes, Ubuntu generally stays more up-to date than Debian in my experience.
>
> And as a result, Debian remains more stable than Ubuntu.
>
> I use them both. I use Debian on my servers where I need stability
> the most, and I use Ubuntu on my desktops where I want (not need) more
> "shiny and new" and can afford occasional downtime to fix things when
> they break.

Interesting. When I chose between Debian and Ubuntu about 4 years ago,
part of my reason for choosing Ubuntu was reading that Ubuntu's package
management was *more conservative* than Ubuntu's, and that as a result
Ubuntu packages were *more stable* than Debian packages. Did something
change in those 4 years?

(I've used both Debian and Ubuntu in that time and not noticed much
difference.)

>
>
> --
> Greg Donald
> destiney.com | gregdonald.com

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Frank Burleigh wrote:
> I have done these commands:
>
> sudo gem update --system
> sudo gem cleanup
>
> sudo gem install tzinfo builder i18n memcache-client rack \
> rake rack-test rack-mount erubis mail text-format \
> thor bundler
> sodu gem install rails --pre
>
> whose execution ends with:
>
> Installing ri documentation for rails-3.0.0.beta3...
> File not found: lib
>
> The gems/rails-3.0.0.beta3 directory has a bin directory with a 20
> character file named "rails." The other gem directories seem fuller.
>


Are you using RVM by any chance? If you are, you cannot use 'sudo' when
installing the gems. I had this issue at first (kept saying File not
found: lib) and then I noticed that RVM installs things as you, not as
sudo. Therefore I just used the command:

'gem install rails --pre' or just 'gem install rails' (since Rails 3 has
been released)

and I got rid of the 'File not found: lib' issue. Hope this helps.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Greg Donald wrote:
> On Tue, Aug 31, 2010 at 2:41 PM, Robert Walker <lists@ruby-forum.com>
> wrote:
>> You're still missing my point entirely. We're talking about representing
>> a time with a Time object. It matters not whether you need to support
>> multi-timezone or not.
>
> I agree, you brought it up.
>
>> AFAIK there is no Ruby object that represents
>> time without date.
>
> It's called a Fixnum, works great.

Yep. I apologize for the misunderstanding. I knew we were arguing the
same side of the issue. It just took me a few tries to get to the heart
of the matter.

Fixnum (INTEGER) is exactly what I typically use as well (i.e. an offset
from midnight).

reu wrote:
> Rails automatically appends a dummy date when you use the TIME type on
> your database. My point is: if you are using a time data type on your
> database, you are doing that exactly because you don't want the date
> included.

My original intent was an effort to explain this question in original
post. Rails is applying a "dummy date" because it must. However, that
time representation is subject to interpretation. And that depends on
what time zone Rails applies to that interpretation.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Thank you much. I get it now!

On Tue, Aug 31, 2010 at 1:37 PM, Michael Pavling <pavling@gmail.com> wrote:
On 31 August 2010 20:24, Todd Weeks <tcr.todd@gmail.com> wrote:
> Im not getting the output I expect. In the tutorial I am doing. It is
> suppose to just write the values to the browser.
> Which would write a,b,c to the browser and shouldn't also be showing the
> array brackets or double quotes.
> Then I would be able to continue to call the values of the array and write
> the results to a browser using ruby code within the erb file.
> My question: Whats wrong with the code I'm writing?

There's nothing wrong with your code, it's working perfectly. But if
you want to iterate the array, there are several ways.
Most commonly, you can use ".each":

<% array = ['a','b','c']  %>
<% array.each do |element| %>
 <%= element %>
<% end %>

but if the format you've noted is specific ("a,b,c") then you can use
the ".join" method:

<% array = ['a','b','c']  %>
<%= array.join(", ") %>


I would recommend having a play with the Enumerable and Array API pages:
http://ruby-doc.org/core/classes/Enumerable.html
http://ruby-doc.org/core/classes/Array.html

Rails add more functionality to these, but getting a grasp on the Ruby
will 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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
Warm Regards,
Todd Weeks
801.814.9084

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

Ruby on Rails

> > In what time zone?
>
To produce a specific part it takes our machine 1 hour and 15 minutes
=> 01:15:00
And I would like to store this value in the database.
Btw it wouldn't matter if this part will be produced on Mondays or
Tuesdays or in which time zone the factory is..

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

Ruby on Rails

On Tue, Aug 31, 2010 at 2:41 PM, Robert Walker <lists@ruby-forum.com> wrote:
> You're still missing my point entirely. We're talking about representing
> a time with a Time object. It matters not whether you need to support
> multi-timezone or not.

I agree, you brought it up.

> AFAIK there is no Ruby object that represents
> time without date.

It's called a Fixnum, works great.


--
Greg Donald
destiney.com | gregdonald.com

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

Ruby on Rails

On 31 August 2010 20:40, Greg Donald <gdonald@gmail.com> wrote:
> On Tue, Aug 31, 2010 at 2:37 PM, Michael Pavling <pavling@gmail.com> wrote:
>> <% array = ['a','b','c']  %>
>
> %w( a b c )

I wasn't going to get into array-making idioms - I just stuck to the
OP's method of populating his array :-)

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

Ruby on Rails

Greg Donald wrote:
> Not all apps require multi-timezone capabilities. Like when everyone
> is in one office, using the same calendar app.
>
> Dreaming up edge cases isn't going to make those time (without date)
> fields any less useful to those of us who use them.

You're still missing my point entirely. We're talking about representing
a time with a Time object. It matters not whether you need to support
multi-timezone or not. AFAIK there is no Ruby object that represents
time without date. The Time object represents an instant in date/time,
not some offset from midnight.

I hope that makes my meaning more clear.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

On Tue, Aug 31, 2010 at 2:37 PM, Michael Pavling <pavling@gmail.com> wrote:
> <% array = ['a','b','c']  %>

%w( a b c )

--
Greg Donald
destiney.com | gregdonald.com

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

Ruby on Rails

On Tue, Aug 31, 2010 at 2:30 PM, Robert Walker <lists@ruby-forum.com> wrote:
> My point being again that any interpretation of whatever gets stored as
> a time only, must be translated into a Time or DateTime object based on
> a specific date, in a specific locale. That's really all I'm saying.
> 4:00 p.m. from your locale may mean 7:30 p.m. in my locale. It's
> dependent on geopolitical rules.

Lots of web apps, certainly dozens I've built, are just for a single
company, with a single office, in a single time zone.

That's great that you build apps where time zone does matter, and that
you build apps for companies where time zone does matter, but it
doesn't make the time (without date) field any less useful to me.


--
Greg Donald
destiney.com | gregdonald.com

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

Ruby on Rails

On 31 August 2010 20:24, Todd Weeks <tcr.todd@gmail.com> wrote:
> Im not getting the output I expect. In the tutorial I am doing. It is
> suppose to just write the values to the browser.
> Which would write a,b,c to the browser and shouldn't also be showing the
> array brackets or double quotes.
> Then I would be able to continue to call the values of the array and write
> the results to a browser using ruby code within the erb file.
> My question: Whats wrong with the code I'm writing?

There's nothing wrong with your code, it's working perfectly. But if
you want to iterate the array, there are several ways.
Most commonly, you can use ".each":

<% array = ['a','b','c'] %>
<% array.each do |element| %>
<%= element %>
<% end %>

but if the format you've noted is specific ("a,b,c") then you can use
the ".join" method:

<% array = ['a','b','c'] %>
<%= array.join(", ") %>


I would recommend having a play with the Enumerable and Array API pages:
http://ruby-doc.org/core/classes/Enumerable.html
http://ruby-doc.org/core/classes/Array.html

Rails add more functionality to these, but getting a grasp on the Ruby
will 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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I have this same problem with devise1.1, I looked for devise-mswin32
but could not find? Please help me
cheers
Omar

On Aug 6, 10:27 pm, Chris Li <li...@ruby-forum.com> wrote:
> Hi everyone
>
>   I want to install ferret on windows. I run the command 'gem install
> ferret', but I got this error.
>
> Building native extensions.  This could take a while...
> ERROR:  Error installing ferret:
>         ERROR: Failed to build gem native extension.
>
> D:/Ruby187/bin/ruby.exe extconf.rb
> creating Makefile
>
> make
> 'make' is not recognized as an internal or external command,
> operable program or batch file.
>
> Gem files will remain installed in
> D:/Ruby187/lib/ruby/gems/1.8/gems/ferret-0.1
> .6 for inspection.
> Results logged to
> D:/Ruby187/lib/ruby/gems/1.8/gems/ferret-0.11.6/ext/gem_make.
> ut
>
> I don't why rails on windows are so many errors.
> --
> Posted viahttp://www.ruby-forum.com/.

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

Ruby on Rails

just look up attr_accessor method, if used within a model on a non
existant field in the model, it will create a "pseudo" field. Do not
forget to make accessible.

On Sep 1, 12:11 am, Michael Pavling <pavl...@gmail.com> wrote:
> correction - you will need to check that both name and times_repeated
> are not nil
>
>  def complete
>   self.name * self.times_repeated if self.name && self.times_repeated
>  end
>
> strictly speaking the "self." isn't needed either, but it does make
> the intention clearer...

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

Ruby on Rails

Robert Walker wrote:
>> If I have a date at 4pm on Tuesday, the date is at 4pm regardless of
>> the state of daylight savings time :-)
>
> In what time zone?

My point being again that any interpretation of whatever gets stored as
a time only, must be translated into a Time or DateTime object based on
a specific date, in a specific locale. That's really all I'm saying.
4:00 p.m. from your locale may mean 7:30 p.m. in my locale. It's
dependent on geopolitical rules.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

On 31 August 2010 20:21, Robert Walker <lists@ruby-forum.com> wrote:
>> If I have a date at 4pm on Tuesday, the date is at 4pm regardless of
>> the state of daylight savings time :-)
>
> In what time zone?

Hopefully she'll be in the same as me wherever it is, otherwise it
probably won't be a very good date.

But, if there is a risk in the implementation that timezones confusion
could cause problems, then store a timezone value in addition to the
time. There's not that much more confusion with timezones caused when
storing just time than with datetime.

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

Ruby on Rails

On Tue, Aug 31, 2010 at 2:21 PM, Robert Walker <lists@ruby-forum.com> wrote:
>> If I have a date at 4pm on Tuesday, the date is at 4pm regardless of
>> the state of daylight savings time :-)
>
> In what time zone?

Not all apps require multi-timezone capabilities. Like when everyone
is in one office, using the same calendar app.

Dreaming up edge cases isn't going to make those time (without date)
fields any less useful to those of us who use them.


--
Greg Donald
destiney.com | gregdonald.com

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

Ruby on Rails

Im not getting the output I expect. In the tutorial I am doing. It is suppose to just write the values to the browser.


Which would write a,b,c to the browser and shouldn't also be showing the array brackets or double quotes.
Then I would be able to continue to call the values of the array and write the results to a browser using ruby code within the erb file.
My question: Whats wrong with the code I'm writing?
Thanks for your feedback!


On Tue, Aug 31, 2010 at 1:48 AM, Michael Pavling <pavling@gmail.com> wrote:
On 31 August 2010 08:29, Todd Weeks <tcr.todd@gmail.com> wrote:
> <%= array = ['a','b','c']  %>
> Shows up in browser as this:
> ["a", "b", "c"]

What's wrong with that?

> Thanks for any suggestions.

Your post doesn't include any questions, so it's a little hard to know
where you want 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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
Warm Regards,
Todd Weeks
801.814.9084

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

Ruby on Rails

Michael Pavling wrote:
> On 31 August 2010 20:15, Robert Walker <lists@ruby-forum.com> wrote:
>> Greg Donald wrote:
>> As I said meaningless without applying the date part to it. If today is
>> Saturday, and the event is scheduled at 4:00 p.m. Tuesday, what happens
>> if the time changes to, or from, daylight savings time at 2:00 a.m.
>> Sunday. The value "4:00 p.m." must be translated based on the specific
>> date the Tuesday lands on. Might as well just store the time as a string
>> at that point. The time has no value as a Time (object) (i.e it must be
>> parsed based on the date anyway).
>
>
> If I have a date at 4pm on Tuesday, the date is at 4pm regardless of
> the state of daylight savings time :-)

In what time zone?
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

On 31 August 2010 20:15, Robert Walker <lists@ruby-forum.com> wrote:
> Greg Donald wrote:
> As I said meaningless without applying the date part to it. If today is
> Saturday, and the event is scheduled at 4:00 p.m. Tuesday, what happens
> if the time changes to, or from, daylight savings time at 2:00 a.m.
> Sunday. The value "4:00 p.m." must be translated based on the specific
> date the Tuesday lands on. Might as well just store the time as a string
> at that point. The time has no value as a Time (object) (i.e it must be
> parsed based on the date anyway).


If I have a date at 4pm on Tuesday, the date is at 4pm regardless of
the state of daylight savings time :-)

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

Ruby on Rails

Robert Walker wrote:
> As I said meaningless without applying the date part to it. If today is
> Saturday, and the event is scheduled at 4:00 p.m. Tuesday, what happens
> if the time changes to, or from, daylight savings time at 2:00 a.m.
> Sunday. The value "4:00 p.m." must be translated based on the specific
> date the Tuesday lands on. Might as well just store the time as a string
> at that point. The time has no value as a Time (object) (i.e it must be
> parsed based on the date anyway).

I suppose though that the TIME field would provide some basic
validation, which would be it's only benefit as far as I see it.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Greg Donald wrote:
> On Tue, Aug 31, 2010 at 1:46 PM, Robert Walker <lists@ruby-forum.com>
> wrote:
>> I personally don't know why MySQL even bothers providing a TIME field
>> type.
>>
>> Of course, as always, I could be missing some specific use case for it.
>
> Repeating events, "Tuesdays at 4:00pm" for example.
>
> PostgreSQL also provides a time field type where no date is stored.

As I said meaningless without applying the date part to it. If today is
Saturday, and the event is scheduled at 4:00 p.m. Tuesday, what happens
if the time changes to, or from, daylight savings time at 2:00 a.m.
Sunday. The value "4:00 p.m." must be translated based on the specific
date the Tuesday lands on. Might as well just store the time as a string
at that point. The time has no value as a Time (object) (i.e it must be
parsed based on the date anyway).
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

correction - you will need to check that both name and times_repeated
are not nil

def complete
 self.name * self.times_repeated if self.name && self.times_repeated
end

strictly speaking the "self." isn't needed either, but it does make
the intention clearer...

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

Ruby on Rails

On 31 August 2010 19:48, lucas franceschi <lukas1596@gmail.com> wrote:
> Word.times = 3
> Word.name = a
> Word.complete = aaa
> got it?
> i wont store that data, but generate it based on the data that is stored.
> any idea????
> did any of you guys see this situation before???

once or twice...

what you're after is a "method"...

(you may run into trouble if you try to call your column 'times', I'll
use 'times_repeated' in this example)

# word.rb
def complete
self.name * self.times_repeated if self.name
end

I recommend going through some Ruby tutorials - the "Ruby for Rails"
book has a good coverage of getting started through to intermediate
use.

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

Ruby on Rails

you didn't get it...


the point is.. i want

Word.complete 

to already be defined, so that in the controller i could use the "complete" column as if it was a real column...
--
Lucas Franceschi
Desenvolvedor
SGI Sistemas
(049) 9922-3360



On Tue, Aug 31, 2010 at 4:01 PM, Fritz Trapper <lists@ruby-forum.com> wrote:
lucas franceschi wrote:
> Word.complete = aaa

Word is the model class - it doesn't store values.

If word is an instance, simply write:

  word[:complete] = aaa
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

lucas franceschi wrote:
> Word.complete = aaa

Word is the model class - it doesn't store values.

If word is an instance, simply write:

word[:complete] = aaa
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

On Tue, Aug 31, 2010 at 1:46 PM, Robert Walker <lists@ruby-forum.com> wrote:
> I personally don't know why MySQL even bothers providing a TIME field
> type.
>
> Of course, as always, I could be missing some specific use case for it.

Repeating events, "Tuesdays at 4:00pm" for example.

PostgreSQL also provides a time field type where no date is stored.


--
Greg Donald
destiney.com | gregdonald.com

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

Ruby on Rails

Hello there..


what i am trying to do, is to consider a new column in my model, a column that do not exist in the database, and will not be created.

imagine, for instance, this case:

I have a table that store a number and a string, lets call it 'words'

--------------------
words
--------------------
int times(PK)
char name
--------------------

imagine Word as an instance of the model, i will have access to these:
Word.times
Word.name

what if i wanted a new column, some like
Word.complete

imagine that this column would store that 'char' for many times as is defined int the 'times' column...
like this

Word.times = 3
Word.name = a
Word.complete = aaa

got it?

i wont store that data, but generate it based on the data that is stored.

any idea????

did any of you guys see this situation before???

--
Lucas Franceschi
Desenvolvedor
SGI Sistemas
(049) 9922-3360

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

Ruby on Rails

Robert Walker wrote:
> Time without data is useless and extremely prone to error. Internally
> time is stored as millisecond offsets from a reference date (e.g. UNIX
> time is the number of milliseconds from midnight January 1, 1970 UTC).
> The date and time related objects in Ruby depend on this underlying
> offset.

Correction: Time without date...
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

reu wrote:
> Rails automatically appends a dummy date when you use the TIME type on
> your database. My point is: if you are using a time data type on your
> database, you are doing that exactly because you don't want the date
> included.
>
> Anyway, I am storing a integer column with the total seconds on the
> database and then transforming that with composed_of. Is there a
> better way to do that? Anyone know if there is a gem or something to
> handle cases like these?

Time without data is useless and extremely prone to error. Internally
time is stored as millisecond offsets from a reference date (e.g. UNIX
time is the number of milliseconds from midnight January 1, 1970 UTC).
The date and time related objects in Ruby depend on this underlying
offset.

a value of 14:00 is meaningless without relating that to some date, in
some time zone, and applying the geopolitical rules for daylight savings
(or other adjustments to the normal flow of time).

I personally don't know why MySQL even bothers providing a TIME field
type.

Of course, as always, I could be missing some specific use case for it.
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

On Tue, Aug 31, 2010 at 1:01 PM, Brad Lindsay <brad.lindsay@gmail.com> wrote:
> Yes, Ubuntu generally stays more up-to date than Debian in my experience.

And as a result, Debian remains more stable than Ubuntu.

I use them both. I use Debian on my servers where I need stability
the most, and I use Ubuntu on my desktops where I want (not need) more
"shiny and new" and can afford occasional downtime to fix things when
they break.


--
Greg Donald
destiney.com | gregdonald.com

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

Ruby on Rails

Please contact me directly at griff@sg.com if you are interesting
working onsite at our client's office in NYC participating in cutting
edge development of financial services applications - $700-$900 per
day.

Thanks,

Kathleen Griffiths
www.sg.com
http://www.linkedin.com/in/kathleengriffiths
www.createthebestyou.com (my life coaching website)

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

Ruby on Rails

On Tue, Aug 31, 2010 at 12:12 PM, Topher <fangiotophia@gmail.com> wrote:
> Regarding Ubuntu Linux: Ubuntu is based off of Debian; do they stay
> more
> up-to-date than the stable branch? If so, I would certainly give it a
> try

Yes, Ubuntu generally stays more up-to date than Debian in my experience.

Brad

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

Ruby on Rails

It was awesome that Nick Kallen gave us Cache-Money but the
unfortunate thing is that people download his original version, have
issues and give up.

Is there any way to promote the http://github.com/ngmoco/cache-money
maintained fork to be what people see on rubygems.org?

Does anyone know if the ngmoco fork of cache-money works with Rails3?
I suspect it no longer works but I have not tried it yet.

If not what alternatives do people suggest? The Rails3 Query cache
still only caches for a single request right?

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

Ruby on Rails

On 31 August 2010 18:38, Armand Macintosh <snip3r.dp@gmail.com> wrote:
> array = ['a','b','c']
> array.each do|x|
>   puts x
> end
>
> results
> a
> b
> c

That's not going to work in his .erb file is it, as 'puts' is going to
write to the console.

If the OP actually asks a question, we'll *know* what he wants to do
with his array rather than taking random stabs in the dark.

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

Ruby on Rails

May be He wants to access the content of the array like this:

array[0] #1
array[1] #2
array[2] #3

Here's how to access the content of the array using .each:

array = ['a','b','c']
array.each do|x|
  puts x
end

results
a
b
c

2010/8/31 Dave Aronson <googlegroups2dave@davearonson.com>
On Aug 31, 3:29 am, Todd Weeks <tcr.t...@gmail.com> wrote:

> Trouble with array syntax below in html.erb file.
> <html>
> <head>
>   <title>Ruby Arrays</title>
> </head>
> <body>
>     <%= array = ['a','b','c']  %>
> </body>
> </html>
>
> Shows up in browser as this:
> ["a", "b", "c"]

That's perfectly valid.  ["a", "b", "c"] is the same as ['a', 'b',
'c'].  That is, "a" is the same as 'a', and so on.  (Unlike in some
languages, where only one or the other is used at all, or some where
it makes a difference in the type, such as C/C++, where 'a' would be a
character and "a" would be an array containing an 'a' and a null.)

When printing values out, Ruby represents strings using double quotes
instead of single as you used.  Ruby doesn't remember (or care) which
you used, once it determines the actual value of the string.

The only time it matters is when *you* are writing a string; single
quotes prevent variables and other "magic strings" taking on their
values.  For example, try this in irb:

>> x = 3
=> 3
>> 'x is #{x}'
=> "x is \#{x}"
>> "x is #{x}"
=> "x is 3"
>> y = "foo"
=> "foo"
>> z = 'foo'
=> "foo"
>> y == z
=> true

-Dave

--
Specialization is for insects. -RAH  | Have Pun, Will Babble! -me
Programming Blog: http://codosaur.us | Work: http://davearonson.com
Leadership Blog:  http://dare2xl.com | Play: http://davearonson.net
* * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.com

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

Ruby on Rails

On Tue, Aug 31, 2010 at 1:12 AM, GD <gongda.fan@gmail.com> wrote:

> I want to use the session object in the rails, but the browser has
> disabled the cookie support. I store some string into the session obj,
> but I can't retrieve the string value in another page.

Possibly helpful:

http://oldwiki.rubyonrails.org/rails/pages/HowToMaintainSessionWhenCookiesAreNotAllowed

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

Ruby on Rails

Many thanks! I was about to post the exact same question.

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

Ruby on Rails

whats the problem in website to ruby on rails wiki?
i cant access for a long time.

thanks.

--
att: Luciano Sousa
http://www.lucianosousa.net

*Ruby on Rails Developer
*Linux User #456387
*Contato: (21) 7639-5049


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

Ruby on Rails

Thank you.

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

Ruby on Rails Monday, August 30, 2010

I am using script/console to debug, but when I make some changes to say
a helper and rerun the method, it doesn't reload the new changes.
"reload!" doesn't work - it only updates model changes. Suggestions? TIA
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

New to RoR, trying to model this correctly (which should be super simple I'd think, but I'm stuck at the moment):

Any given "User" of the app can have a group of "friends" (where friends are also users.) (think typical facebook friends concept.)

I know I should have a 'user_friends' table that has two user_ids as fks to the User table one for the user and the other to hold multiple 'friends'

My first shot is looking like this...

class User < ActiveRecord::Base
  acts_as_authentic
  has_many :user_friends, :dependent => :destroy
  has_many :friends, :class_name => "User", :foreign_key => "friend_id", :through => :user_friends, :dependent => :destroy
end

class UserFriend < ActiveRecord::Base
  belongs_to :user
  belongs_to :user, :class_name => "User", :foreign_key => "friend_id"
end

#migration
class CreateUserFriends < ActiveRecord::Migration
  def self.up
    create_table :user_friends, :id => false do |t|
      t.integer :user_id
      t.integer :friend_id
      t.timestamps
    end
  end

When I run my test, it barfs saying

Failures:
  1) User should create a user and some friends
     Failure/Error: user.friends << f1 << f2
     Could not find the source association(s) :user_friends in model UserFriend. 
Try 'has_many :friends, :through => :user_friends, :source => <name>'.  Is it one of :user?

Where my test looks like:

it "should create a user and some friends" do
    user = Factory.create(:user_rick)
    f1 = Factory.create(:user_rachel)
    f2 = Factory.create(:user_fred)
    user.friends << f1 << f2



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

Ruby on Rails

On 30 August 2010 21:50, Marnen Laibow-Koser <lists@ruby-forum.com> wrote:
> Colin Law wrote:
>> On 30 August 2010 18:02, Marnen Laibow-Koser <lists@ruby-forum.com>
>> wrote:
>>>
>>> Then you absolutely should not be using <b>. �Use something semantic
>>> instead, or if your design supports it, recast the whole thing into a
>>> <table> and use <th> and <td> (which is what I'd normally do). �The
>>> semantics are tabular, so a <table> element would be quite appropriate.
>>
>> As I said before, I agree entirely.  But as I also said before it is a
>> little used admin page and so improving the aesthetics of the html is
>> not the most important job at the moment.
>>
>
> I quite understand that, though at the same time I like to take a "fix
> broken windows" approach -- that is, I like to fix obvious small
> problems if I'm working on the file anyway.
>

Agreed again, I am not actually modifying that page, just adding a
test for a special case.

Cheers

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

Ruby on Rails

Colin Law wrote:
> On 30 August 2010 21:17, Ithelp Eighty-five <lists@ruby-forum.com>
> wrote:
>>> the field in the object being passed to the view. �So if the object is
>>> @my_thing and the field is value then set @my_thing.value = "" or
>>> possibly nil might be better.
>>>
>>> Colin
>>
>> Where should this code go? In the Model, View, or controller?
>
> After the failed save, which is in the update and/or create action of
> the controller. I think maybe the fact that you had to ask that
> question means you might benefit from working through the Rails Guides
> (google it).
>
> Colin

Thanks I had just realize it went in the controller.

Another question... if I want to set a field blank for each field that
had an error how would i do that?
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

On 30 August 2010 21:17, Ithelp Eighty-five <lists@ruby-forum.com> wrote:
> Colin Law wrote:
>> On 30 August 2010 18:01, Ithelp Eighty-five <lists@ruby-forum.com>
>> wrote:
>>> Hello everyone I have a problem in my app with the validation on
>>> numericality. The field should be all numbers, and if an user types for
>>> example "12345abc" into the field an error is raised and the data is not
>>> saved. But in the field where the error was raised it now says "12345",
>>> I want this field to be blank instead.
>>
>> In the update and/or create action, after the failed save, just blank
>> the field in the object being passed to the view.  So if the object is
>> @my_thing and the field is value then set @my_thing.value = "" or
>> possibly nil might be better.
>>
>> Colin
>
> Where should this code go? In the Model, View, or controller?

After the failed save, which is in the update and/or create action of
the controller. I think maybe the fact that you had to ask that
question means you might benefit from working through the Rails Guides
(google it).

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

Ruby on Rails

Colin Law wrote:
> On 30 August 2010 18:02, Marnen Laibow-Koser <lists@ruby-forum.com>
> wrote:
>>
>> Then you absolutely should not be using <b>. �Use something semantic
>> instead, or if your design supports it, recast the whole thing into a
>> <table> and use <th> and <td> (which is what I'd normally do). �The
>> semantics are tabular, so a <table> element would be quite appropriate.
>
> As I said before, I agree entirely. But as I also said before it is a
> little used admin page and so improving the aesthetics of the html is
> not the most important job at the moment.
>

I quite understand that, though at the same time I like to take a "fix
broken windows" approach -- that is, I like to fix obvious small
problems if I'm working on the file anyway.

> Colin

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org

Sent from my iPhone
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

Colin Law wrote:
> On 30 August 2010 18:01, Ithelp Eighty-five <lists@ruby-forum.com>
> wrote:
>> Hello everyone I have a problem in my app with the validation on
>> numericality. The field should be all numbers, and if an user types for
>> example "12345abc" into the field an error is raised and the data is not
>> saved. But in the field where the error was raised it now says "12345",
>> I want this field to be blank instead.
>
> In the update and/or create action, after the failed save, just blank
> the field in the object being passed to the view. So if the object is
> @my_thing and the field is value then set @my_thing.value = "" or
> possibly nil might be better.
>
> Colin

Where should this code go? In the Model, View, or controller?
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

On 30 August 2010 18:02, Marnen Laibow-Koser <lists@ruby-forum.com> wrote:
> Colin Law wrote:
>> On 30 August 2010 16:44, Chris Mear <chrismear@gmail.com> wrote:
>>>>> much more complex tasks but my mind seems to have gone blank and
>>> http://dev.w3.org/html5/spec/Overview.html#the-b-element
>>>
>>> Everything old is new again.
>>
>> Though actually I think my use case is not such as described there, it
>> being a list of column names (bold) and values, generated by a Rails
>> scaffold some years ago.
>
> Then you absolutely should not be using <b>.  Use something semantic
> instead, or if your design supports it, recast the whole thing into a
> <table> and use <th> and <td> (which is what I'd normally do).  The
> semantics are tabular, so a <table> element would be quite appropriate.

As I said before, I agree entirely. But as I also said before it is a
little used admin page and so improving the aesthetics of the html is
not the most important job at the moment.

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

Ruby on Rails

Bill Walton wrote:
> On Mon, Aug 30, 2010 at 2:19 PM, Robert Walker <lists@ruby-forum.com>
> wrote:
>>>>
>>>> +1.  If only marnen were in charge....  ;-)
>>>
>>> The HTML 5 spec itself says <b> is only to be used as a last resort if
>>> no other element is more appropriate.  IMHO, that's never the case: even
>>> if nothing more specific can be found, <span> is more appropriate than
>>> <b>.
>>
>> I have to agree with Marnen. Are we criticizing people for emphasizing
>> exactly what the HTML5 spec states now?
>
> Speaking for myself, I am criticizing marnen's obnoxious and
> judgmental posts.

I didn't intend to be obnoxious. I *did* intend to be judgmental of bad
practice.

> A post such as yours that takes the time to explain
> to a poster why one approach is favored over another is welcome,
> "that's bad" is simply an unsubstantiated opinion.

I explained my rationale in an earlier post. You appatently neither
read it nor asked for the clarification which I would have been happy to
reiterate if requested. This is not the first time that you've taken me
to task for supposedly failing to provide information that I in fact
provided.

Legitimate criticism is welcome. But if you can't bother to check that
the criticism is borne out by the facts, then please don't bother to
post it.

> If he's not going
> to provide assistance, he should either keep his mouth shut or be
> ready to be chastised / derided in the same manner he treats others.

I provide lots of assistance, and regularly get thanked for it. If
you're going to criticize something about my posts, please make sure the
criticism actually applies. In this case, your stated criticism was
simply inaccurate.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org

Sent from my iPhone
--
Posted via http://www.ruby-forum.com/.

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

Ruby on Rails

On 30 August 2010 18:01, Ithelp Eighty-five <lists@ruby-forum.com> wrote:
> Hello everyone I have a problem in my app with the validation on
> numericality. The field should be all numbers, and if an user types for
> example "12345abc" into the field an error is raised and the data is not
> saved. But in the field where the error was raised it now says "12345",
> I want this field to be blank instead.

In the update and/or create action, after the failed save, just blank
the field in the object being passed to the view. So if the object is
@my_thing and the field is value then set @my_thing.value = "" or
possibly nil might be better.

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

Ruby on Rails

On Mon, Aug 30, 2010 at 2:48 PM, Bill Walton <bwalton.im@gmail.com> wrote:
> Speaking for myself, I am criticizing marnen's obnoxious and
> judgmental posts.  A post such as yours that takes the time to explain
> to a poster why one approach is favored over another is welcome,
> "that's bad" is simply an unsubstantiated opinion.  If he's not going
> to provide assistance, he should either keep his mouth shut or be
> ready to be chastised / derided in the same manner he treats others.

Ditto.


--
Greg Donald
destiney.com | gregdonald.com

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

Ruby on Rails

On Mon, Aug 30, 2010 at 2:19 PM, Robert Walker <lists@ruby-forum.com> wrote:
> Marnen Laibow-Koser wrote:
>> Bill Walton wrote:
>>> On Mon, Aug 30, 2010 at 11:24 AM, Greg Donald <gdonald@gmail.com> wrote:
>>>> On Mon, Aug 30, 2010 at 11:18 AM, Marnen Laibow-Koser
>>>> <lists@ruby-forum.com> wrote:
>>>>> I didn't say it was invalid HTML. �I said it was *bad practice*.
>>>>
>>>> Yeah, that's why it's in the spec, 'cause no one should use it.
>>>>
>>>> /rolls eyes
>>>
>>> +1.  If only marnen were in charge....  ;-)
>>
>> The HTML 5 spec itself says <b> is only to be used as a last resort if
>> no other element is more appropriate.  IMHO, that's never the case: even
>> if nothing more specific can be found, <span> is more appropriate than
>> <b>.
>
> I have to agree with Marnen. Are we criticizing people for emphasizing
> exactly what the HTML5 spec states now?

Speaking for myself, I am criticizing marnen's obnoxious and
judgmental posts. A post such as yours that takes the time to explain
to a poster why one approach is favored over another is welcome,
"that's bad" is simply an unsubstantiated opinion. If he's not going
to provide assistance, he should either keep his mouth shut or be
ready to be chastised / derided in the same manner he treats others.

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

Ruby on Rails

Bulls eye! That was it

On Aug 30, 12:16 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On Aug 30, 8:02 pm, badnaam <asitkmis...@gmail.com> wrote:
>
> > This is what I have
>
> >     belongs_to :user, :counter_cache => true
> >     belongs_to :vote_item, :counter_cache => true
> >     belongs_to :vote_topic, :counter_cache => true
>
> > ##User model
>
> > def vote_for(vid, vtid)
> >         Vote.create(:user_id => self.id, :vote_item_id =>
> > vid, :vote_topic_id => vtid)
> >     end
>
> >     def cancel_vote(vid, vtid)
> >         Vote.find(:first, :select => "id", :conditions =>
> > ['vote_item_id = ? AND vote_topic_id = ? AND user_id = ?', vid, vtid,
> > self.id]).destroy
> >     end
>
> > When a vote is created the votes_count in VoteItem and VoteTopic are
> > updated correctly. But when a vote is destroyed or cancelled the
> > counter is not decremented.
>
> Stab in the dark: because your select clause only includes id, rails
> doesn't know the user_id/vote_item_id/vote_topic_id and so doesn't
> know which user/vote_item/vote_topic to update.
>
> Fred
>
> > Please 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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.