rubyonrailsin

A Ruby and Rails talk

Wednesday, March 10, 2010

[spree-user] Re: New site and IE6 problems --> is Spree Edge not working there?

by rubyonrailsin 0 comments
Thanks Michael, I'm looking it right now also... I don't know what are
we going to do!

On 10 mar, 19:59, Michael Guterl <mgut...@gmail.com> wrote:
> I can confirm that the default UI looks really bad in IE6.
>
> On Wed, Mar 10, 2010 at 1:34 PM, liebana <carloslieb...@gmail.com> wrote:
> > Hello,
>
> > We're finishing our first Spree implementation, after a hard job you
> > can see it in action here -->www.defloresyfloreros.com
>
> > We're fixing some bugs found using IE6 (that due to the complains of
> > our client, it's still being used more often than we thought), but
> > there are others that are getting me out of my mind, I don't know if
> > due to the template implementation or to the Spree core functionality:
> > users are telling us that they can't register and checkout.
>
> > My question: is Spree Edge really working in IE6?
>
> > Thanks a lot in advance.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Spree" group.
> > To post to this group, send email to spree-user@googlegroups.com.
> > To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/spree-user?hl=en.

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

Read More…

Re: [Radiant-Dev] Re: Draggable sort of pages?

by rubyonrailsin 0 comments
Huh. I'll test it out- thanks!

On Wed, Mar 10, 2010 at 3:52 AM, rubybox <voorruby@gmail.com> wrote:
> 9.x edge
> I haven tried it on a Windows. But on mentioned browser the slider
> could not be moved.
>
> On Mar 10, 12:16 am, banane <ban...@gmail.com> wrote:
>> Which version of Radiant are you using?
>>
>>
>>
>> On Tue, Mar 9, 2010 at 10:49 AM, rubybox <voorr...@gmail.com> wrote:
>> >http://github.com/banane/radiant-drag-order
>> > Did not work for me in Safari 4 OSX
>> > Nor firefox latest version OSX
>>
>> > I try Dirk's Thx
>>
>> > On Mar 9, 5:32 pm, "[Square Talent] Dirk Kelly"
>> > <dirk.ke...@squaretalent.com> wrote:
>> >> I'm going to check out Anna's bug fixes in the morning, would be cool if we
>> >> can see a bit of a speed improvement, also the idea of moving the handles
>> >> away from the remove makes me smile.
>>
>> >> On Wed, Mar 10, 2010 at 12:24 AM, Jonathan Kinney <jonkin...@gmail.com>wrote:
>>
>> >> > I've used Dirk's fork, it works flawlessly (albeit a bit slow, not
>> >> > anything he did). I'd recommend it.
>> >> > -Jon
>>
>> >> > On Tue, Mar 9, 2010 at 7:52 AM, [Square Talent] Dirk Kelly
>> >> > <dirk.ke...@squaretalent.com> wrote:
>> >> > > I have a working 0.9.0 branch
>> >> > >http://github.com/squaretalent/radiant-drag-extension
>> >> > > Just let bright4 know
>> >> > > On Tue, Mar 9, 2010 at 9:29 PM, rubybox <voorr...@gmail.com> wrote:
>>
>> >> > >> The only usefull one I found was this one:
>>
>> >> > >>http://github.com/bright4/radiant-drag-order
>>
>> >> > >> Which is not working with 9.x
>> >> > >> I try to look into it and try to fix
>>
>> >> > >> So no real working solution for 9.x edge exist if im correct
>>
>> >> > >> On Mar 9, 2:18 pm, William Ross <w...@spanner.org> wrote:
>> >> > >> > Have you tried typing 'drag' into the search box in the radiant
>> >> > >> > extension registry? That would be an excellent place to start.
>>
>> >> > >> > best,
>>
>> >> > >> > will
>>
>> >> > >> > On 9 Mar 2010, at 13:15, rubybox wrote:
>>
>> >> > >> > > Could not find any extensions to sort the page order with drag and
>> >> > >> > > drop,
>> >> > >> > > Anyone made such a extension?
>>
>> >> > >> > > This should be a essential feature for the Core In my humble opinion
>>
>> >> > >> > > --
>> >> > >> > > Radiant CMS Dev Mailing List
>> >> > >> > > Post:        radiantcms-dev@googlegroups.com
>> >> > >> > > Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
>> >> > >> > > Group Site:  http://groups.google.com/group/radiantcms-dev/
>>
>> >> > >> --
>> >> > >> Radiant CMS Dev Mailing List
>> >> > >> Post:        radiantcms-dev@googlegroups.com
>> >> > >> Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
>> >> > >> Group Site:  http://groups.google.com/group/radiantcms-dev/
>>
>> >> > > --
>> >> > > Radiant CMS Dev Mailing List
>> >> > > Post: radiantcms-dev@googlegroups.com
>> >> > > Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
>> >> > > Group Site:http://groups.google.com/group/radiantcms-dev/
>>
>> >> > --
>> >> > Radiant CMS Dev Mailing List
>> >> > Post:        radiantcms-dev@googlegroups.com
>> >> > Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
>> >> > Group Site:  http://groups.google.com/group/radiantcms-dev/
>>
>> > --
>> > Radiant CMS Dev Mailing List
>> > Post:        radiantcms-dev@googlegroups.com
>> > Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
>> > Group Site:  http://groups.google.com/group/radiantcms-dev/
>
> --
> Radiant CMS Dev Mailing List
> Post:        radiantcms-dev@googlegroups.com
> Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
> Group Site:  http://groups.google.com/group/radiantcms-dev/

--
Radiant CMS Dev Mailing List
Post: radiantcms-dev@googlegroups.com
Unsubscribe: radiantcms-dev-unsubscribe@googlegroups.com
Group Site: http://groups.google.com/group/radiantcms-dev/

Read More…

Re: [spree-user] New site and IE6 problems --> is Spree Edge not working there?

by rubyonrailsin 0 comments
I can confirm that the default UI looks really bad in IE6.

On Wed, Mar 10, 2010 at 1:34 PM, liebana <carlosliebana@gmail.com> wrote:
> Hello,
>
> We're finishing our first Spree implementation, after a hard job you
> can see it in action here --> www.defloresyfloreros.com
>
> We're fixing some bugs found using IE6 (that due to the complains of
> our client, it's still being used more often than we thought), but
> there are others that are getting me out of my mind, I don't know if
> due to the template implementation or to the Spree core functionality:
> users are telling us that they can't register and checkout.
>
> My question: is Spree Edge really working in IE6?
>
> Thanks a lot in advance.
>
> --
> You received this message because you are subscribed to the Google Groups "Spree" group.
> To post to this group, send email to spree-user@googlegroups.com.
> To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
>
>

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

Read More…

[Rails] Re: How to hide an object???

by rubyonrailsin 0 comments
On Mar 10, 3:51 pm, Robert Walker <li...@ruby-forum.com> wrote:
> Guille San wrote:
> > Hi
> > I only have one question more. How can I do this example with prototype:
>
> > Example in jQuery
> > -------------------
> > $(document).ready(function() {
> >   $('#my_element').hide();
> > });
>
> I wish Prototype had this built-in. However, it's pretty easy to add the
> onDOMReady extension script and then use the following:
>
Isn't that what prototype's dom:loaded event does (http://
www.prototypejs.org/api/document/observe )

Fred

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

Read More…

[spree-user] New site and IE6 problems --> is Spree Edge not working there?

by rubyonrailsin 0 comments
Hello,

We're finishing our first Spree implementation, after a hard job you
can see it in action here --> www.defloresyfloreros.com

We're fixing some bugs found using IE6 (that due to the complains of
our client, it's still being used more often than we thought), but
there are others that are getting me out of my mind, I don't know if
due to the template implementation or to the Spree core functionality:
users are telling us that they can't register and checkout.

My question: is Spree Edge really working in IE6?

Thanks a lot in advance.

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

Read More…

[Rails] Re: Re: Re: Re: Three submits, one controller

by rubyonrailsin 0 comments
Colin Law wrote:

>
> You can specify the action in the form_for statement.
>
Thats all I wanted to know, but HOW ,I'm afraid I can't yet understand
anything more complex.

Neil
--
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.

Read More…

Re: [Rails] Re: Is there a rails way to validate format of an email addr

by rubyonrailsin 0 comments
> Aldric Giacomoni wrote:
>> Robert Walker wrote:
>>> Marnen Laibow-Koser wrote:
>>>> Robert Walker wrote:
>>>>> Rajinder Yadav wrote:
>>>>>> How can I validate and email address without using complex reg-
>>>>>> ex is
>>>>>> there a simple rails way to do this?
>>>>>
>>>>> Are you nuts? That's just the sort of thing Regexp was designed
>>>>> to do.
>>>>> And, it's not really all that complex.
>>>>
>>>> Yes it is. The *only* correct regexps I am aware of for e-mail
>>>> addresses are on the order of a page in length. All shorter
>>>> regexps
>>>> reject some valid e-mail addresses.
>>>
>>> Thanks Marnen. I stand corrected.
>>>
>>> However, just to clarify, are you saying that Regexp is still the
>>> best
>>> approach? Given that what you're saying is true, which I'm sure it
>>> is,
>>> then I could imagine that performing this validation without using
>>> Regexp would be even more complex and require quite a bit more code.
>>
>> The best approach is to download a plugin for email validation,
>> because
>> someone, somewhere, has already done all the work ;-)
>
> I wouldn't trust those plugins without inspecting their algorithms. I
> would probably use something like the following regex:
> /^.+@.+\..+$/
>
> This checks that it's of the form "something@something.something", but
> performs no further validation.

Good point. It annoys me to no end when I can't enter philip+sitename@pjkh.com
as a valid email address. Seems this works about half the time.

The bottom line is if you are really concerned about getting a valid
email address, the only way to completely verify it is to send them an
email and make them confirm it via a link in that email. Headache,
yeah, but it works.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.

Read More…

Re: [Rails] How to make an array available to all views.

by rubyonrailsin 0 comments
On 10 March 2010 12:10, Andy Jeffries <andyjeffries@gmail.com> wrote:
>> If it is literally something as simple as MyArray.all I believe there
>> is nothing wrong with calling the model direct from the view.
>
> It's dirty, horrible, bad form, breaks the separation of layers...

I don't know what you mean by dirty, it saves several lines of code
and when looking at the view code it is easier to see what is
happening than to see a variable that has to be hunted for in a filter
somewhere to find out what it is.

It does not break the separation of layers any more than calling an
instance method of a model does when using something like
<%= @person.name %>

> Don't call the model from the view!

@person.name is a model call from the view

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.

Read More…

[Rails] Re: Re: How to make an array available to all views.

by rubyonrailsin 0 comments
Marnen Laibow-Koser wrote:
> Example:
> # controller
> def my_action
> @person = Person.find(params[:id])
> end
>
> #my_action.html.erb
> Good: <%= @person.name >
> Bad: <% @person.save! =>
> Unspeakable: <% @people = Person.all %>

Good example. I just want to throw in a couple more twists and see what
you think.

1. What about methods on models that change themselves in some way?

<%= @post.last_viewed_at %>

Suppose the last_viewed_at method returned a previously stored time,
then updated the model to store a new current time. Maybe a bad example,
but I hope you get my meaning.

2. What about aggregating class methods like count, sum or avg?

<%= Person.count %>

Obviously a class methods and does touch the database. I assume it would
be better to let the controller deal with stuff like this.

Controller
@person_count = Person.count

View
<%= @person_count %>

Thoughts anyone?
--
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.

Read More…

Re: [Rails] Re: Re: How to make an array available to all views.

by rubyonrailsin 0 comments
On 10 March 2010 17:19, Marnen Laibow-Koser <lists@ruby-forum.com> wrote:
> Colin Law wrote:
>> On 10 March 2010 15:15, Marnen Laibow-Koser <lists@ruby-forum.com>
>> wrote:
>>> Sharagoz -- wrote:
>>>>>> If it is literally something as simple as MyArray.all I believe there
>>>>>> is nothing wrong with calling the model direct from the view.
>>>
>>> But you are wrong. �The view should never, ever, ever touch the
>>> database.
>>
>> Is it considered ok to call model methods if they do not touch the db,
>> or are model methods forbidden also?
>
> I think it is appropriate for the view to call methods on the objects
> passed in by the controller, provided that these methods do not change
> the model or touch the database.
>
> Example:
> # controller
> def my_action
>  @person = Person.find(params[:id])
> end
>
> #my_action.html.erb
> Good: <%= @person.name >

What about <%= @person.group_name %>
where Person belongs to Group and group_name is an instance method of Person
def group_name
group.name if group
end

> Bad: <% @person.save! =>

I would class the above as the unspeakable one actually.

> Unspeakable: <% @people = Person.all %>

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.

Read More…

[Rails] Re: Re: How to make an array available to all views.

by rubyonrailsin 0 comments
Colin Law wrote:
> On 10 March 2010 15:15, Marnen Laibow-Koser <lists@ruby-forum.com>
> wrote:
>> Sharagoz -- wrote:
>>>>> If it is literally something as simple as MyArray.all I believe there
>>>>> is nothing wrong with calling the model direct from the view.
>>
>> But you are wrong. �The view should never, ever, ever touch the
>> database.
>
> Is it considered ok to call model methods if they do not touch the db,
> or are model methods forbidden also?

I think it is appropriate for the view to call methods on the objects
passed in by the controller, provided that these methods do not change
the model or touch the database.

Example:
# controller
def my_action
@person = Person.find(params[:id])
end

#my_action.html.erb
Good: <%= @person.name >
Bad: <% @person.save! =>
Unspeakable: <% @people = Person.all %>

>
> Colin

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.

Read More…

[Rails] Re: belongs_to :through

by rubyonrailsin 0 comments
Marnen Laibow-Koser wrote:
> Joaquin Rivera padron wrote:
>> hi there,
>> lets say you have: A that belongs_to :b, and B belongs_to :c
>>
>> how do you normally go about saying A belongs_to :c, :through => :b ??
>
> If A belongs_to :b, that means that Rails expects a b_id field in A's
> table. In your case, that doesn't exist, so what you want is
> A has_one :c, :through => :b

Wow, that was stupid of me. I must not have been awake when I wrote
that. has_one :through will probably work, but my explanation is
totally inaccurate. Sorry.

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

Read More…

[Rails] Re: Is there a rails way to validate format of an email addr

by rubyonrailsin 0 comments
Aldric Giacomoni wrote:
> Robert Walker wrote:
>> Marnen Laibow-Koser wrote:
>>> Robert Walker wrote:
>>>> Rajinder Yadav wrote:
>>>>> How can I validate and email address without using complex reg-ex is
>>>>> there a simple rails way to do this?
>>>>
>>>> Are you nuts? That's just the sort of thing Regexp was designed to do.
>>>> And, it's not really all that complex.
>>>
>>> Yes it is. The *only* correct regexps I am aware of for e-mail
>>> addresses are on the order of a page in length. All shorter regexps
>>> reject some valid e-mail addresses.
>>
>> Thanks Marnen. I stand corrected.
>>
>> However, just to clarify, are you saying that Regexp is still the best
>> approach? Given that what you're saying is true, which I'm sure it is,
>> then I could imagine that performing this validation without using
>> Regexp would be even more complex and require quite a bit more code.
>
> The best approach is to download a plugin for email validation, because
> someone, somewhere, has already done all the work ;-)

I wouldn't trust those plugins without inspecting their algorithms. I
would probably use something like the following regex:
/^.+@.+\..+$/

This checks that it's of the form "something@something.something", but
performs no further validation.

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.

Read More…

[Rails] Re: Suggest a wav or aiff player

by rubyonrailsin 0 comments
Srikanth Jeeva wrote:
> Hi,
>
> Plz suggest me a player to play .wav or .aiff files. so that i can use
> it in my Ruby on Rails App.

The server-side has nothing to do with this. Players exists client-side.
Web browsers will typically rely on a plugin to play sound files. For
instance on the Mac, QuickTime is the default player for these types of
files. Windows will, of course, use Windows Media Player by default.

http://www.w3schools.com/media/media_browsersounds.asp
--
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.

Read More…

Re: [Rails] Re: Is there a rails way to validate format of an email addr

by rubyonrailsin 0 comments
Philip Hallstrom wrote:
>> Robert Walker wrote:
>>> Marnen Laibow-Koser wrote:
>>>> Robert Walker wrote:
>>>>> Rajinder Yadav wrote:
>>>>>> How can I validate and email address without using complex reg-ex is
>>>>>> there a simple rails way to do this?
>>>>>
>>>>> Are you nuts? That's just the sort of thing Regexp was designed to do.
>>>>> And, it's not really all that complex.
>>>>
>>>> Yes it is. The *only* correct regexps I am aware of for e-mail
>>>> addresses are on the order of a page in length. All shorter regexps
>>>> reject some valid e-mail addresses.
>>>
>>> Thanks Marnen. I stand corrected.
>>>
>>> However, just to clarify, are you saying that Regexp is still the best
>>> approach? Given that what you're saying is true, which I'm sure it is,
>>> then I could imagine that performing this validation without using
>>> Regexp would be even more complex and require quite a bit more code.
>>
>> The best approach is to download a plugin for email validation, because
>> someone, somewhere, has already done all the work ;-)
>
>
> Several some ones...
>
> http://agilewebdevelopment.com/plugins/validates_as_email
> http://agilewebdevelopment.com/plugins/validates_as_email_address
> http://agilewebdevelopment.com/plugins/validates_email_format_of
>
Thanks Philip =)

--
Kind Regards,
Rajinder Yadav

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.

Read More…

[Rails] Re: Re: Is there a rails way to validate format of an email

by rubyonrailsin 0 comments
Philip Hallstrom wrote:
> http://agilewebdevelopment.com/plugins/validates_email_format_of

This one does look interesting. Even has support for checking DNS MX
records. I see more clearly now what Marnen was talking about. This
plugin certainly does use Regexp, and I have to admit it is quite
complex. :-)
--
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.

Read More…

Re: [Rails] Re: Is there a rails way to validate format of an email addr

by rubyonrailsin 0 comments
> Robert Walker wrote:
>> Marnen Laibow-Koser wrote:
>>> Robert Walker wrote:
>>>> Rajinder Yadav wrote:
>>>>> How can I validate and email address without using complex reg-
>>>>> ex is
>>>>> there a simple rails way to do this?
>>>>
>>>> Are you nuts? That's just the sort of thing Regexp was designed
>>>> to do.
>>>> And, it's not really all that complex.
>>>
>>> Yes it is. The *only* correct regexps I am aware of for e-mail
>>> addresses are on the order of a page in length. All shorter regexps
>>> reject some valid e-mail addresses.
>>
>> Thanks Marnen. I stand corrected.
>>
>> However, just to clarify, are you saying that Regexp is still the
>> best
>> approach? Given that what you're saying is true, which I'm sure it
>> is,
>> then I could imagine that performing this validation without using
>> Regexp would be even more complex and require quite a bit more code.
>
> The best approach is to download a plugin for email validation,
> because
> someone, somewhere, has already done all the work ;-)


Several some ones...

http://agilewebdevelopment.com/plugins/validates_as_email
http://agilewebdevelopment.com/plugins/validates_as_email_address
http://agilewebdevelopment.com/plugins/validates_email_format_of

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.

Read More…

[spree-user] Re: Can't start spree, javan-whenever bails the Mongrel startup, and rake tasks

by rubyonrailsin 0 comments
This is also bailing passenger on my production server. you can see
it here: http://beta.dixiestarkhome.com/

It seems to be my initiallzer:

Spree::Initializer.run do |config|
# Settings in config/environments/* take precedence over those
specified here.
# Application configuration should go into files in config/
initializers
# -- all .rb files in that directory are automatically loaded.
# See Rails::Configuration for more options.

# Skip frameworks you're not going to use. To use Rails without a
database
# you must remove the Active Record framework.
# config.frameworks -=
[ :active_record, :active_resource, :action_mailer ]

# Specify gems that this application depends on.
# They can then be installed with "rake gems:install" on new
installations.
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://
code.whytheluckystiff.net"
# config.gem "aws-s3", :lib => "aws/s3"

config.gem "highline", :version => '>=1.4.0'
config.gem 'authlogic', :version => '>=2.0.11'
config.gem "activemerchant", :lib => "active_merchant", :version =>
'>=1.4.1'
config.gem "tlsmail", :version => '0.0.1'
config.gem 'activerecord-tableless', :lib => 'tableless', :version
=> '>=0.1.0'
config.gem 'haml', :version => '>=2.2.0'
config.gem 'compass', :version => '0.8.17', :source => "http://
gemcutter.org"
config.gem 'calendar_date_select', :version => '1.15'
config.gem 'rsl-stringex', :lib => 'stringex', :source => "http://
gems.github.com"
config.gem 'chronic' #required for whenever
config.gem 'whenever', :lib => false, :source => 'http://
gemcutter.org/'
config.gem 'searchlogic', :version => '>= 2.3.5'
config.gem 'mislav-will_paginate', :version => '~> 2.3.11', :lib =>
'will_paginate',
:source => 'http://gems.github.com'


# Only load the plugins named here, in the order given. By default,
all plugins
# in vendor/plugins are loaded in alphabetical order.
# :all can be used as a placeholder for all plugins not explicitly
named
# config.plugins =
[ :exception_notification, :ssl_requirement, :all ]
config.plugins = [ :all, :resource_controller, :extension_patches ]

# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )

# Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
# config.log_level = :debug

# Make Time.zone default to the specified zone, and make Active
Record store time values
# in the database in UTC, and return them converted to the specified
local zone.
# Run "rake -D time" for a list of tasks for finding time zone
names.
config.time_zone = "Eastern Time (US & Canada)"

# Use SQL instead of Active Record's schema dumper when creating the
test database.
# This is necessary if your schema can't be completely dumped by the
schema dumper,
# like if you have constraints or database-specific column types
config.active_record.schema_format = :sql

# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector

# The internationalization framework can be changed to have another
default locale (standard is :en) or more load paths.
# All files from config/locales/*.rb,yml are added automatically.
#config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales',
'*.{rb,yml}')]
config.i18n.default_locale = :'en-US'

config.active_record.observers = :order_observer
end

This site is pretty much ready to go, and I don't think I changed
anything. Still getting the NameError on the localhost as well:
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:440:in `load_missing_constant':
uninitialized constant Calculator::Ups::Base (NameError)

I am using the Active Shipping but not sure why I would get this
problem.

On Mar 10, 3:05 am, ravenna <t...@ravennainteractive.com> wrote:
> Ya I am using Active Shipping...
>
> On Mar 10, 1:41 am, Paul Callaghan <p...@railsdog.com> wrote:
>
> > Are you using one of the shipping extensions?
>
> > Paul
>
> > On Wed, Mar 10, 2010 at 5:23 AM, ravenna <t...@ravennainteractive.com> wrote:
> > > Turns out the name changed to simple the "whenever" gem.  Changed the
> > > environment.rb file and the error changed to the following:
> > > Loading haml-edge gem.
> > > /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > active_support/dependencies.rb:440:in `load_missing_constant':
> > > uninitialized constant Calculator::Ups::Base (NameError)
>
> > > Not sure what changed but this is pretty frustrating, I had the whole
> > > thing working... any ideas?
>
> > > On Mar 9, 6:55 pm, ravenna <t...@ravennainteractive.com> wrote:
> > > > Expected /usr/local/lib/ruby/gems/1.8/gems/javan-whenever-0.3.7/lib/
> > > > base.rb to define Base .  This is what I get if I run a rake task
>
> > > > Loading haml-edge gem.
> > > > /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:426:in `load_missing_constant':
> > > > Expected /usr/local/lib/ruby/gems/1.8/gems/javan-whenever-0.3.7/lib/
> > > > base.rb to define Base (LoadError)
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:80:in `const_missing'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:92:in `const_missing'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:437:in `load_missing_constant'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:96:in `const_missing'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:437:in `load_missing_constant'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:80:in `const_missing'
> > > >         from
> > > /Users/tjs/Sites/dshome/vendor/extensions/active_shipping/app/
> > > > models/calculator/ups/ground.rb:1
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:380:in
> > > > `load_without_new_constant_marking'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:380:in `load_file'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:521:in `new_constants_in'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:379:in `load_file'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:259:in `require_or_load'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:425:in `load_missing_constant'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:80:in `const_missing'
> > > >         from /Users/tjs/Sites/dshome/vendor/extensions/active_shipping/
> > > > active_shipping_extension.rb:11:in `activate'
> > > >         from
> > > ./script/../config/../vendor/spree/lib/spree/extension.rb:34:in
> > > > `activate'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:145:in `to_proc'
> > > >         from
> > > ./script/../config/../vendor/spree/lib/spree/extension_loader.rb:
> > > > 95:in `each'
> > > >         from
> > > ./script/../config/../vendor/spree/lib/spree/extension_loader.rb:
> > > > 95:in `activate_extensions'
> > > >         from ./script/../config/../vendor/spree/lib/spree/initializer.rb:
> > > > 132:in `after_initialize'
> > > >         from
> > > /Users/tjs/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > > > 179:in `process'
> > > >         from
> > > /Users/tjs/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > > > 113:in `send'
> > > >         from
> > > /Users/tjs/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > > > 113:in `run'
> > > >         from ./script/../config/../vendor/spree/lib/spree/initializer.rb:
> > > > 97:in `run'
> > > >         from /Users/tjs/Sites/dshome/config/environment.rb:13
> > > >         from
> > > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> > > > 31:in `gem_original_require'
> > > >         from
> > > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> > > > 31:in `require'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:156:in `require'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:521:in `new_constants_in'
> > > >         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > > > active_support/dependencies.rb:156:in `require'
> > > >         from
> > > /Users/tjs/.gem/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:
> > > > 84
> > > >         from
> > > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> > > > 31:in `gem_original_require'
> > > >         from
> > > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> > > > 31:in `require'
> > > >         from script/server:3
>
> > > > Is what I get if I try and start the server.
>
> > > > My environment requires just like its supposed to.  Also Javan-
> > > > Whenever is up to date.
>
> > > > Any ideas?
>
> > > > thanks
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Spree" group.
> > > To post to this group, send email to spree-user@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > spree-user+unsubscribe@googlegroups.com<spree-user%2Bunsubscribe@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/spree-user?hl=en.

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

Read More…

[Rails] Re: How to hide an object???

by rubyonrailsin 0 comments
Some questions:

I want to hide the object while it loading and show it when it load
completely, it could be something like that, or I´m totally wrong:


<script type="text/javascript">
Object.extend(Event, {
_domReady : function() {
if (arguments.callee.done) return;
arguments.callee.done = true;

if (this._timer) clearInterval(this._timer);

this._readyCallbacks.each(function(f) { f() });
this._readyCallbacks = null;
},
onDOMReady : function(f) {
if (!this._readyCallbacks) {
var domReady = this._domReady.bind(this);

if (document.addEventListener)
document.addEventListener("DOMContentLoaded", domReady, false);

/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer
src=javascript:void(0)><\/script>");
document.getElementById("__ie_onload").onreadystatechange =
function() {
if (this.readyState == "complete") domReady();
};
/*@end @*/

if (/WebKit/i.test(navigator.userAgent)) {
this._timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) domReady();
}, 10);
}

Event.observe(window, 'load', domReady);
Event._readyCallbacks = [];
}
Event._readyCallbacks.push(f);
}
});
function lastSpy() {

var target = $('imagen');

if (!target) return false;
new Ajax.PeriodicalUpdater(target,
'http://localhost:3000/',{frequency:'1'})

}
Event.observe(window, 'load', lastSpy, false);

</script>
<div id="imagen" style='display: none;'>
<%=image_tag("/guarrada/Debug/foto.jpg") %>
</div>
Event.onDOMReady(function() {
$('imagen').show();
})

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

Read More…

[Rails] Re: Is there a rails way to validate format of an email addr

by rubyonrailsin 0 comments
Robert Walker wrote:
> Marnen Laibow-Koser wrote:
>> Robert Walker wrote:
>>> Rajinder Yadav wrote:
>>>> How can I validate and email address without using complex reg-ex is
>>>> there a simple rails way to do this?
>>>
>>> Are you nuts? That's just the sort of thing Regexp was designed to do.
>>> And, it's not really all that complex.
>>
>> Yes it is. The *only* correct regexps I am aware of for e-mail
>> addresses are on the order of a page in length. All shorter regexps
>> reject some valid e-mail addresses.
>
> Thanks Marnen. I stand corrected.
>
> However, just to clarify, are you saying that Regexp is still the best
> approach? Given that what you're saying is true, which I'm sure it is,
> then I could imagine that performing this validation without using
> Regexp would be even more complex and require quite a bit more code.

The best approach is to download a plugin for email validation, because
someone, somewhere, has already done all the work ;-)
--
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.

Read More…

Re: [spree-user] Image sizes

by rubyonrailsin 0 comments
both answers are in the spree guides:

1. under preferences
2. at the end of the products guide,

Paul



On Wed, Mar 10, 2010 at 3:52 PM, Michel B <michel.bouchoucha@gmail.com> wrote:
Hello to everybody,

Finally, what is the right approach to initialize :
1/ the default language
2/ the default sizes of product images

Many Thanks.

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


--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
Read More…

[Rails] Re: Data Type Question

by rubyonrailsin 0 comments
Yudi Soesanto wrote:
> How i can store integer data type and when application display the data
> back
> (Since it will do calculation) it will display float on each column
> points,
> assists, blocks and turnovers?

This seems to be a basic Ruby question. See the following IRB session:
>> x = 25
=> 25
>> y = 3
=> 3
>> z = x / y
=> 8
>> z = x.to_f / y.to_f
=> 8.33333333333333
>> puts "%0.3f" % z
8.333
--
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.

Read More…

[Rails] Re: How to hide an object???

by rubyonrailsin 0 comments
Hi:
Sometimes I feel that I am so stupid. I put in my view the following:

<script type="text/javascript">

function lastSpy() {

var target = $('imagen');

if (!target) return false;
new Ajax.PeriodicalUpdater(target,
'http://localhost:3000/',{frequency:'1'})
}

Event.observe(window, 'load', lastSpy, false);
</script>
<div id="imagen">
<%=image_tag("/guarrada/Debug/foto.jpg") %>
</div>

$(document).ready(function() {
$('#imagen').hide();
});


and in the layout carpet inthe home.html.erb I added
<%= javascript_include_tag 'jquery'%>

What´s exactly wrong??

Thanks for your time


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

Read More…

[spree-user] Image sizes

by rubyonrailsin 0 comments
Hello to everybody,

Finally, what is the right approach to initialize :
1/ the default language
2/ the default sizes of product images

Many Thanks.

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

Read More…

[Rails] Re: How to hide an object???

by rubyonrailsin 0 comments
Guille San wrote:
> Hi
> I only have one question more. How can I do this example with prototype:
>
> Example in jQuery
> -------------------
> $(document).ready(function() {
> $('#my_element').hide();
> });

I wish Prototype had this built-in. However, it's pretty easy to add the
onDOMReady extension script and then use the following:

Event.onDOMReady(function() {
$('my_element').hide();
});

You can find that extension script here:
http://smoothoperatah.com/files/onDOMReady.js

Otherwise, you can also just wait for the whole page to load with
something like:
Event.observe(window, "load", function() {
$('my_element').hide();
});

I prefer using the onDOMReady extension because it's designed to wait
only for the DOM itself to load and not the entire page, and does so
with cross browser support.
--
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.

Read More…

Re: [Rails] Where to find plugins?

by rubyonrailsin 0 comments
Github might be your friend

On 10 March 2010 14:27, Aldric Giacomoni <lists@ruby-forum.com> wrote:
Is there another place than agilewebdevelopment.com/plugins to find a
list of Rails plugins?
--
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.




--
100% naturally selected. 0% designed.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.
Read More…

Re: [spree-user] Heroku and 0.10.0.beta?

by rubyonrailsin 0 comments
Thanks Steph! 

On Mar 10, 2010, at 4:01 PM, Steph Powell wrote:

Hi,

I worked through some issues Monday and blogged about it here yesterday: http://blog.endpoint.com/2010/03/spree-heroku-development-environment.html

Some of the issues will look familiar if you've used heroku before, but I was new to Heroku so I had to work through everything. Main new thing was with the new default theme there were problems in copying the theme public/ dir to the main app public dir.

Steph

 

On Mar 10, 2010, at 1:58 AM, Peter Berkenbosch <peterberkenbosch@me.com> wrote:

On Mar 10, 2010, at 1:47 AM, Jason wrote:

Does anyone know if the 0.10.0.beta works on Heroku?

Don't know... but gonna try later today.. let's see where it takes me...  I will keep the list posted.


Thanks,

-Jason

Peter

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

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

Read More…

Re: [Rails] Re: How to hide an object???

by rubyonrailsin 0 comments
On Wed, Mar 10, 2010 at 7:33 AM, Guille San <lists@ruby-forum.com> wrote:

> I only have one question more. How can I do this example with prototype:
>
> Example in jQuery
> -------------------
> $(document).ready(function() {

google: prototype.js api document ready

>  $('#my_element').hide();

google: prototype.js api hide element

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

Read More…

[Rails] Re: Is there a rails way to validate format of an email addr

by rubyonrailsin 0 comments
Marnen Laibow-Koser wrote:
> Robert Walker wrote:
>> Rajinder Yadav wrote:
>>> How can I validate and email address without using complex reg-ex is
>>> there a simple rails way to do this?
>>
>> Are you nuts? That's just the sort of thing Regexp was designed to do.
>> And, it's not really all that complex.
>
> Yes it is. The *only* correct regexps I am aware of for e-mail
> addresses are on the order of a page in length. All shorter regexps
> reject some valid e-mail addresses.

Thanks Marnen. I stand corrected.

However, just to clarify, are you saying that Regexp is still the best
approach? Given that what you're saying is true, which I'm sure it is,
then I could imagine that performing this validation without using
Regexp would be even more complex and require quite a bit more code.
--
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.

Read More…

[Rails] Re: How to hide an object???

by rubyonrailsin 0 comments
Hi
I only have one question more. How can I do this example with prototype:

Example in jQuery
-------------------
$(document).ready(function() {
$('#my_element').hide();
});

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

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

Read More…

[Rails] Re: xml question

by rubyonrailsin 0 comments
That works :)
--
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.

Read More…

Re: [Rails] Re: How to make an array available to all views.

by rubyonrailsin 0 comments
> But you are wrong.  The view should never, ever, ever touch the
> database.

Is it considered ok to call model methods if they do not touch the db,
or are model methods forbidden also?

I would say the view can call instance methods of the model (attributes - real and virtual) but no class methods.

So:

<%= @user.name %>

is OK, but:


is not.  It's a bit of a contrived example, but there you go.  Accessing the model through instance variables you've created is OK, going directly to the model bypassing the controller is not.

Cheers,


Andy

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.
Read More…

Re: [Rails] Re: How to make an array available to all views.

by rubyonrailsin 0 comments
On 10 March 2010 15:15, Marnen Laibow-Koser <lists@ruby-forum.com> wrote:
> Sharagoz -- wrote:
>>>> If it is literally something as simple as MyArray.all I believe there
>>>> is nothing wrong with calling the model direct from the view.
>
> But you are wrong.  The view should never, ever, ever touch the
> database.

Is it considered ok to call model methods if they do not touch the db,
or are model methods forbidden also?

Colin

>
>>>>
>>>
>>> It's dirty, horrible, bad form, breaks the separation of layers...
>> Beware of the MVC police Colin, this suggestion will certanly not get
>> good housekeeping seal of approval :D
>>
>> I agree through. I'm not gonna add a before filter just to set
>> MyArray.all into a class variable. I'd rather call it directly and claim
>> to be pragmatic.
>
> Claim all you like.  The fact is that in MVC architecture, database
> queries don't belong in the view.  A before_filter is the proper place
> for this.
>
> 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.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.

Read More…

[Rails] Re: How to make an array available to all views.

by rubyonrailsin 0 comments
Sharagoz -- wrote:
>>> If it is literally something as simple as MyArray.all I believe there
>>> is nothing wrong with calling the model direct from the view.

But you are wrong. The view should never, ever, ever touch the
database.

>>>
>>
>> It's dirty, horrible, bad form, breaks the separation of layers...
> Beware of the MVC police Colin, this suggestion will certanly not get
> good housekeeping seal of approval :D
>
> I agree through. I'm not gonna add a before filter just to set
> MyArray.all into a class variable. I'd rather call it directly and claim
> to be pragmatic.

Claim all you like. The fact is that in MVC architecture, database
queries don't belong in the view. A before_filter is the proper place
for this.

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.

Read More…

[Rails] Re: EAV Model vs Rails

by rubyonrailsin 0 comments
Sumeet Panchal wrote:
> Hi,
>
> I have a relational database (MySQL) with 200 tables in it. Now I want
> to reduce number of tables (If it helps in improving the
> application).

Why? There's nothing wrong with having 200 tables if they're necessary
to model your data properly.

On the other hand, 200 is a high number, and you could probably stand
some normalization or something.

>
> One approach is to use EAV database model.
[...]

And it's a *very* bad approach. Don't do this unless there is no other
way to model your data sensibly. If you can say more about your schema,
perhaps we can offer better suggestions.

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.

Read More…

Re: [Rails] Re: Re: Re: Three submits, one controller

by rubyonrailsin 0 comments
On Wed, Mar 10, 2010 at 8:22 AM, Colin Law <clanlaw@googlemail.com> wrote:
> On 10 March 2010 12:44, Neil Bye <lists@ruby-forum.com> wrote:
>> Colin Law wrote:
>> .
>>>
>>> Do you mean you have two submits in one form?  You had not mentioned
>>> that before, or I missed it.
>>>
>>> Colin
>> There are three separate forms on three pages but they all refer to the
>> stories_controller.rb . In the controller I a 'create' method  for the
>> 'new' page
>> The 'update' method  is for comments submitted on the 'show' page. Now I
>> want an 'edit' page with a submit. What method can I use and how does
>> the submit on the edit page know how to use it.
>>
>> Attachments:
>> http://www.ruby-forum.com/attachment/4562/stories_controller.rb
>
> You can specify the action in the form_for statement.
>
> However, as I suggested earlier I would not use a separate action
> anyway.  If you look at your code for update and add_comment you will
> see there is a lot of similarity.  I would combine add_comment into
> update and test params[:comment] to see whether to add the comment or
> not.

A more conventional approach here might be to treat comments as nested
resources, and have a Comments controller.

http://railscasts.com/episodes/139-nested-resources

And if you substitute Story for Article in Ryan's example app in the
railscast, it would appear to pretty much be the OPs problem.
--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

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

Read More…

[Rails] Re: Is there a rails way to validate format of an email addr

by rubyonrailsin 0 comments
Robert Walker wrote:
> Rajinder Yadav wrote:
>> How can I validate and email address without using complex reg-ex is
>> there a simple rails way to do this?
>
> Are you nuts? That's just the sort of thing Regexp was designed to do.
> And, it's not really all that complex.

Yes it is. The *only* correct regexps I am aware of for e-mail
addresses are on the order of a page in length. All shorter regexps
reject some valid e-mail addresses.

Just check for the . and @, and trust the user for the rest.

> The Rails docs even use email
> validation as the example for validates_format_of so it's not like you
> have to write the "complex" regex yourself. Just copy-and-paste:
>
> class Person < ActiveRecord::Base
> validates_format_of :email, :with =>
> /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :on => :create
> end

That regexp is just a simple example. It isn't even close to covering
all valid e-mail addresses. Don't use it.

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.

Read More…

[Rails] Re: belongs_to :through

by rubyonrailsin 0 comments
Joaquin Rivera padron wrote:
> hi there,
> lets say you have: A that belongs_to :b, and B belongs_to :c
>
> how do you normally go about saying A belongs_to :c, :through => :b ??

If A belongs_to :b, that means that Rails expects a b_id field in A's
table. In your case, that doesn't exist, so what you want is
A has_one :c, :through => :b

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.

Read More…

Re: [spree-user] Heroku and 0.10.0.beta?

by rubyonrailsin 0 comments
Hi,

I worked through some issues Monday and blogged about it here yesterday: http://blog.endpoint.com/2010/03/spree-heroku-development-environment.html

Some of the issues will look familiar if you've used heroku before, but I was new to Heroku so I had to work through everything. Main new thing was with the new default theme there were problems in copying the theme public/ dir to the main app public dir.

Steph

 

On Mar 10, 2010, at 1:58 AM, Peter Berkenbosch <peterberkenbosch@me.com> wrote:

On Mar 10, 2010, at 1:47 AM, Jason wrote:

Does anyone know if the 0.10.0.beta works on Heroku?

Don't know... but gonna try later today.. let's see where it takes me...  I will keep the list posted.


Thanks,

-Jason

Peter

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
Read More…

[spree-user] ¿Problem/doubt? with shipments in Spree demo

by rubyonrailsin 0 comments
Hi,

I'm new in Spree and I dont't know if it's a problem with the Spree
demo or it's my problem.

1.- Go to Spree Administration screen.
2.- Go to th Orders List.
3.- Select one order with status "New" and push "Edit".
4.- Go to Payments Section and Capture the payment. The Order status
is changed to "Paid".
Here is the problem:
5.- Go to Shipments Section. The shipment continues with status
"Pending" and when you try to edit the shipment the "Shipped" button
doesn't appear and according with [1] seems that must appear and the
shipment status must to change to ready_to_ship.


[1] http://groups.google.com/group/spree-user/browse_thread/thread/ba3ee56b5219237/eb4a0b0b55156ef7?lnk=gst&q=Shipped#eb4a0b0b55156ef7

Thanks in advance.

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

Read More…

Re: [Rails] Using store values from drop down list

by rubyonrailsin 0 comments
On 10 March 2010 14:41, Andy Jeffries <andyjeffries@gmail.com> wrote:
> I would change that as follows:
> CLUB_TYPES = {
>   "pub" => "Public",
>   "vil" => "Village",
>   "pvt" => "Private"
> }
>

...as long as there's no need for clubtypes to be displayed in any
particular order (arrays are returned in order, hashs aren't
necessarily)


For the minuscule amount of extra effort involved, create a model for
club types, seed it, and give it a "position" column if you want to
manage the order (or just put an :order clause on your default
finder).

Then use ClubType.all or named scopes for more functionality ...

Your clubs can change their club_type text column into a club_type_id
integer and add a belongs_to relationship, allowing you to do nice
easy queries, leverage Rails' functionality, and get rid of those
"magic" array/hash variables.

Sometimes things that seem like shortcuts (like using an array for
some "static" data) can quickly turn into dead ends. The framework
does all the hard work for you, so you might as well use it.

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

Read More…

Re: [Rails] Re: How to make an array available to all views.

by rubyonrailsin 0 comments
>> If it is literally something as simple as MyArray.all I believe there
>> is nothing wrong with calling the model direct from the view.
>>
>
> It's dirty, horrible, bad form, breaks the separation of layers...
Beware of the MVC police Colin, this suggestion will certanly not get
good housekeeping seal of approval :D

It's not about MVC policing, I couldn't give a monkey's what you do in your app, but given that there is an easy way of handling it shouldn't you describe the correct method to any new developers.
 
I agree through. I'm not gonna add a before filter just to set
MyArray.all into a class variable. I'd rather call it directly and claim
to be pragmatic.

How do you work out duplicating a line of code in every action is being "pragmatic"?

DRY mean anything to ya?

Cheers,


Andy

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.
Read More…

[Rails] belongs_to :through

by rubyonrailsin 0 comments
hi there,
lets say you have:  A that belongs_to :b, and B belongs_to :c

how do you normally go about saying A belongs_to :c, :through => :b ??

searching I found two solutions:

1. method:
class A
def c
  b.c
end
end

and

2.delegate:
class A
delegate :c, :to => :b
end

but neither will have the benefits of generated sql with joins.

How you normally do this? and What are the reasons against having it on rails itself?

greetings
joaquin

--
www.least-significant-bit.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.
Read More…

[Rails] Re: xml question

by rubyonrailsin 0 comments
Nobody Else wrote:
> Does anyone know what the correct way of setting an attribute for an xml
> element is? I know how to do it, but once I try to pass data to it, it
> shows up as an empty element in de outputted xml.
>
> What I have now is the following:
>
> xml.InstdAmt("Ccy" => "EUR") {invoice.sum_after_tax}
>
> Which outputs:
>
> <InstdAmt Ccy="EUR"></InstdAmt>

The block is for adding child elements to an element.

Try this instead:

xml.InstdAmt({ "Ccy" => "EUR" }, invoice.sum_after_tax)

So if, for example the above element was a child of a root element you
might have something like:

xml.RootElement do
xml.InstdAmt({ "Ccy" => "EUR" }, invoice.sum_after_tax)
end

Notice that the block is used to add the child element, which has an
attribute arg (a hash) and a value arg (element contents).

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

Read More…

[Rails] Re: How to make an array available to all views.

by rubyonrailsin 0 comments
>> If it is literally something as simple as MyArray.all I believe there
>> is nothing wrong with calling the model direct from the view.
>>
>
> It's dirty, horrible, bad form, breaks the separation of layers...
Beware of the MVC police Colin, this suggestion will certanly not get
good housekeeping seal of approval :D

I agree through. I'm not gonna add a before filter just to set
MyArray.all into a class variable. I'd rather call it directly and claim
to be pragmatic.
--
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.

Read More…

Re: [Rails] Using store values from drop down list

by rubyonrailsin 0 comments
# model code

 CLUB_TYPES = [
# Displayed stored in db
 [ "Public" , "pub" ],
 [ "Village" , "vil" ],
 [ "Private" , "pvt" ]
 ]

I would change that as follows:

CLUB_TYPES = {
  "pub" => "Public",
  "vil" => "Village",
  "pvt" => "Private"
}
 
 validates_inclusion_of :club_type, :in =>
         CLUB_TYPES.map {|disp, value| value}

So that becomes:

validates_inclusion_of :club_type, :in => CLUB_TYPES.keys
 
#view code

 <%= f.select :club_type, Club::CLUB_TYPES, :prompt => "Select a Club
Type" %>

I think when using a hash you need to invert it, something like this:

 <%= f.select :club_type, Club::CLUB_TYPES.invert, :prompt => "Select a Club
Type" %>

You may need to play with that a little bit...  I can't remember and don't have time to test it at the second...
 
This works fine for getting data into the database.

My question: Is there a helper to get the display value back from the
database? If not, could somebody show me how to correct the following
to get the display value rather than the stored value.
 
 <b>Club Type:</b>
 <%= @club.club_type %>

<%= Club::CLUB_TYPES[@club.club_type] %>

(or more likely a method on the model call club_type_description or something similar that does the same thing).

Cheers,


Andy

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.
Read More…

[Rails] Using store values from drop down list

by rubyonrailsin 0 comments
Hi,

I was trying to understand stored values vs display values.

# model code

CLUB_TYPES = [
# Displayed stored in db
[ "Public" , "pub" ],
[ "Village" , "vil" ],
[ "Private" , "pvt" ]
]

validates_inclusion_of :club_type, :in =>
CLUB_TYPES.map {|disp, value| value}

#view code

<%= f.select :club_type, Club::CLUB_TYPES, :prompt => "Select a Club
Type" %>

This works fine for getting data into the database.

My question: Is there a helper to get the display value back from the
database? If not, could somebody show me how to correct the following
to get the display value rather than the stored value.

<b>Club Type:</b>
<%= @club.club_type %>

Thanks

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

Read More…

Subscribe feeds via e-mail

Blog Archive