rubyonrailsin

A Ruby and Rails talk

Tuesday, March 30, 2010

Re: [Radiant-Dev] Compass in Core?

by rubyonrailsin 0 comments
On Tue, Mar 30, 2010 at 7:31 PM, john muhl <johnmuhl@gmail.com> wrote:
> shouldn't `opacity= !opacity` be the last line there? it seems to me
> it would be preferable for browsers that support the standard
> declaration to use it.

I'm on board with that. Feel free to make the change.

--
John Long
http://wiseheartdesign.com
http://recursivecreative.com

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

To unsubscribe, reply using "remove me" as the subject.

Read More…

Re: [Radiant-Dev] [Proposal] Join forces to deal with extensions and Rails3

by rubyonrailsin 0 comments
On migrations, I'm wondering if we should take a different approach.
Perhaps each extension should just generate the necessary migrations?

--
John Long
http://wiseheartdesign.com
http://recursivecreative.com

On Tue, Mar 30, 2010 at 3:05 PM, Sean Schofield
<sean.schofield@gmail.com> wrote:
> I have several thoughts on how to approach this but the client work is
> getting insane again.  I'll take a rough stab at this sometime soon
> and report back what I find.  Basically I think we can use Rails3 for
> most everything.  We just need to understand more about the
> limitations or gotchas that require additional spree/radiant hacks.
> With any luck its nothing and this is just an exercise in proving
> that.
>
> Sean Schofield
>
> On Mon, Mar 29, 2010 at 1:31 PM, Travis D Warlick Jr
> <warlickt@operissystems.com> wrote:
>> I think this is a wonderful idea.  In my walk-throughs of new Rails 3 code,
>> I've noticed a number of things that Rails now has .  Count me in for help.
>>
>> I'd like to throw out an idea (which may require a new thread, but I'll
>> start it here since it's closely related): Radiant/spree as a plugin gem.  I
>> have a very large upcoming project.  It needs a CMS, but it also needs
>> functionality that Radiant isn't the best choice for.  Currently, I'm forced
>> to write two apps, which doesn't sit well with me.
>>
>> Here's my hypotheses on the benefits of using a plugin gem:
>>
>> * Passenger memory savings with smart spawning.
>> * Built-in support for extension dependencies.
>> * radiant command offload to rails -m <radiant-install-script>
>>  - easy integration of "radiant-more" via install scripts?
>>  - radiant-more install script repository, similiar to ext.radiantcms.org?
>>
>> Thoughts? Criticisms?
>>
>> -- Travis Warlick
>>
>> On 3/26/10 7:48 PM, Sean Schofield wrote:
>>>
>>> I'd like to introduce myself.  My name is Sean Schofield, and I'm the
>>> creator of the Spree e-commerce project.  Spree has an extension
>>> system very similar to the one in Radiant.  Actually we based our
>>> extension system on the one in Radiant and received some very helpful
>>> insight from Sean Cribbs at the time.
>>>
>>> Now that Rails3 is rolling around we're finding ourselves discussing
>>> the future of extensions.  We're planning on taking a serious look at
>>> this issue starting a few weeks from now.  One of the guys on the
>>> Spree core team suggested that we might want to reach out to the
>>> Radiant devs to see if they were interested in working together on
>>> this problem.  A side benefit would be that it could become easier to
>>> integrate Spree and Radiant for sites that require both e-commerce and
>>> CMS.
>>>
>>> So I wanted to ask if there was any interest in working on a common
>>> solution for implementing Radiant/Spree style extensions in Rails3.  I
>>> was thinking we might want to create a separate github project for the
>>> purposes of exploring this.  It could serve as a starting point for
>>> exploring the concept but maybe it could evolve into a stand-alone gem
>>> dependency that would work with Radiant or Spree.
>>>
>>> Is there any interest in exploring this together from the Radiant
>>> community?
>>>
>>> Sean
>>>
>>
>> --
>> 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/
>>
>> To unsubscribe from this group, send email to
>> radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the
>> words "REMOVE ME" as the subject.
>>
>
> --
> 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/
>
> To unsubscribe from this group, send email to radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>

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

[Rails] Re: Loading 3000 models to Ruby on Rails. Performances???

by rubyonrailsin 0 comments
no need to answer find the answer using eval
--
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: Loading 3000 models to Ruby on Rails. Performances???

by rubyonrailsin 0 comments
The next question is.
---------- is it possible to convert this -----
Object::const_set(name.intern, Class::new do
def write
puts "TEST"
end
end
)


--------- convert above to -----------------
string_test = ' def write
puts "TEST"
end'
Object::const_set(name.intern, Class::new do
string_test
end
)

-------- is that possible?
--
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: Loading 3000 models to Ruby on Rails. Performances???

by rubyonrailsin 0 comments
John John wrote:
> E. Litwin wrote:
>> You may really want to look at a NoSQL option, like MongoDB.
>
> Yes, I indeed using NoSQL. Even with NoSQL, you still need Model Class
> to save and retrieve data. :).

oh yeah, I think I found the solution of using Object::const_set
--
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: Loading 3000 models to Ruby on Rails. Performances???

by rubyonrailsin 0 comments
E. Litwin wrote:
> You may really want to look at a NoSQL option, like MongoDB.

Yes, I indeed using NoSQL. Even with NoSQL, you still need Model Class
to save and retrieve data. :).
--
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: Loading 3000 models to Ruby on Rails. Performances???

by rubyonrailsin 0 comments
You may really want to look at a NoSQL option, like MongoDB.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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: [Radiant-Dev] Compass in Core?

by rubyonrailsin 0 comments
On Tue, Mar 30, 2010 at 10:43 AM, John Long <johnwlong2000@gmail.com> wrote:
> I've included some of the modules form compass, but I am a little
> picky on the kinds of things that I want included. I prefer that we
> work out something custom for Radiant.

while we're on the topic of core sass/css. can i ask why the modules
prefer proprietary declarations over standard ones? for example from
the opacity module(same goes for rounded and shadow and maybe more...i
got tired of looking):

=opacity(!opacity)
opacity= !opacity
-moz-opacity= !opacity
-khtml-opacity= !opacity
-webkit-opacity= !opacity
filter= "alpha(opacity=" + round(!opacity*100) + ")"
-ms-filter= "progid:DXImageTransform.Microsoft.Alpha(Opacity=" +
round(!opacity*100) + ")"

shouldn't `opacity= !opacity` be the last line there? it seems to me
it would be preferable for browsers that support the standard
declaration to use it.

> --
> John Long
> http://wiseheartdesign.com
> http://recursivecreative.com
>
> On Tue, Mar 30, 2010 at 10:55 AM, [Square Talent] Dirk Kelly
> <dirk.kelly@squaretalent.com> wrote:
>> I pretty much use compass for clearfix, 960, stickyfooter and (in edge)
>> rounded corners.
>> Like Will said, it just means less code repetition. Could be just as useful
>> to have them in modules (which I see is what John has done in his prototype)
>> DK
>>
>> On Tue, Mar 30, 2010 at 10:40 PM, William Ross <will@spanner.org> wrote:
>>>
>>> On 29 Mar 2010, at 11:17, Mislav Marohnić wrote:
>>>
>>> > First of all, we should ask ourselves what does "Compass in core" mean
>>> > for Radiant? It means that the admin interface is done using it. So until
>>> > someone actually steps up and has a strong argument for using Compass for
>>> > the admin UI (and actually does the work), I don't think Radiant will ship
>>> > with Compass.
>>>
>>>
>>> I don't see a need for all of compass in core, so I'd vote no too, but it
>>> would be useful to offer a standard grid for more complex forms. I've been
>>> experimenting with a sassified version of the 960 grid system in
>>> sass/admin/_modules. It's quite compact, and being programmatic it has the
>>> great advantage of working with whatever widths and margins you specify,
>>> including percentages as well as pixel values.
>>>
>>> You can make a full-width 12-column grid very easily like this:
>>>
>>>        http://gist.github.com/349148
>>>
>>> It's a nice example of the sort of thing sass does well. The css original
>>> is over 600 lines, and in the event calendar (which I'm just now converting
>>> to 0.9) it means that most of the layout is as simple as this:
>>>
>>>      @import modules/_grid.sass
>>>      p.title
>>>        +grid(8)
>>>      p.keywords
>>>        +grid(4)
>>>      p.description
>>>        +grid(12)
>>>
>>> I haven't done many browser tests yet but it does seem worthwhile. Anyone?
>>>
>>> will
>>>
>>>
>>>
>>> --
>>> 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/
>>>
>>> To unsubscribe from this group, send email to
>>> radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the
>>> words "REMOVE ME" as the subject.
>>
>> --
>> 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/
>>
>> To unsubscribe from this group, send email to
>> radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the
>> words "REMOVE ME" as the subject.
>>
>
> --
> 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/
>
> To unsubscribe from this group, send email to radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>

--
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: [Rails] Re: Joining Multiple Tables

by rubyonrailsin 0 comments
On Tue, Mar 30, 2010 at 6:35 PM, khagimoto <kumi.hagimoto@gmail.com> wrote:
> Not sure if I understand this completely..  The "activity_type" field
> is in Activity.
>
> If I try to do as you suggested, it complains that
>    "Association named 'code' was not found"
> when it tries to execute the line Activity.find...
>

Did you add the association declaration:

belongs_to :code, :foreign_key => "activity_type"

to the Activity class?

That says that the activities table has a foreign key field called
activity_type which is the key of a record in the codes table.

And it creates the association called code which the error message is
complaining about.

> On Mar 30, 1:05 pm, Rick DeNatale <rick.denat...@gmail.com> wrote:
>> On Tue, Mar 30, 2010 at 3:03 PM, khagimoto <kumi.hagim...@gmail.com> wrote:
>> > I'm trying to replicate a join in RoR that I can do in SQL very
>> > simply.
>>
>> > Three tables/models that I have are: Users, Users_Activities,
>> > Activities and Codes.
>>
>> > Users and Activities have appropriate has_many associations through
>> > Users_Activities model, so it's easy to do a join to get all
>> > activities for a given user.
>>
>> > Codes, on the other hand, is a different story.  It's kind of a
>> > "repository" of all codified data.  For example, the Activity table
>> > has a "Activity Type" field that is an integer field.  To get the
>> > actual Activity Type name, you have to look it up in the Codes table
>> > like so (joining with user table to get all activities for user id
>> > "1"):
>>
>> > select activities.*, codes.name from activities, users_activities,
>> > codes
>> > where users_activities.user_id = 1
>> >   and users_activities.activity_id = activities.id
>> >   and activities.activity_type = codes.id
>>
>> > I can do part of the above query if i don't include the Codes table
>> > like so:
>>
>> > Activity.all(:joins => :users_activities, :conditions =>
>> > {'users_activities.user_id' => "1"})
>>
>> > How do I also join Codes?
>>
>> class User < AcrtiveRecord::Base
>>   has_many :user_activities
>> end
>>
>> class UserActivity < ActiveRecord::Base
>>    belongs_to :user
>>    belongs_to :code, :foreign_key => "activity_type"
>> end
>>
>> Activity.find_all_by_user_id(1, :include => :code)
>>
>> This will return a collection of all of the activities for user#1 with
>> attached instances of the code for each activity
>>
>> --
>> 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.
>
>

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

[spree-user] sagepay

by rubyonrailsin 0 comments
Hi I'm trying to use protx/sagepay using the default without 3des.
I've got a test account setup with sagepay.
I've enabled the protx gateway in admin, have tried server settings of
test and production
but It doesn't appear to be working. I get authorisation code 12345
each time. How do I
check everything is set up correctly. Does anyone have the basic protx
working.
Thanks for any help
regards
Martin

--
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: Joining Multiple Tables

by rubyonrailsin 0 comments
Not sure if I understand this completely.. The "activity_type" field
is in Activity.

If I try to do as you suggested, it complains that
"Association named 'code' was not found"
when it tries to execute the line Activity.find...


On Mar 30, 1:05 pm, Rick DeNatale <rick.denat...@gmail.com> wrote:
> On Tue, Mar 30, 2010 at 3:03 PM, khagimoto <kumi.hagim...@gmail.com> wrote:
> > I'm trying to replicate a join in RoR that I can do in SQL very
> > simply.
>
> > Three tables/models that I have are: Users, Users_Activities,
> > Activities and Codes.
>
> > Users and Activities have appropriate has_many associations through
> > Users_Activities model, so it's easy to do a join to get all
> > activities for a given user.
>
> > Codes, on the other hand, is a different story.  It's kind of a
> > "repository" of all codified data.  For example, the Activity table
> > has a "Activity Type" field that is an integer field.  To get the
> > actual Activity Type name, you have to look it up in the Codes table
> > like so (joining with user table to get all activities for user id
> > "1"):
>
> > select activities.*, codes.name from activities, users_activities,
> > codes
> > where users_activities.user_id = 1
> >   and users_activities.activity_id = activities.id
> >   and activities.activity_type = codes.id
>
> > I can do part of the above query if i don't include the Codes table
> > like so:
>
> > Activity.all(:joins => :users_activities, :conditions =>
> > {'users_activities.user_id' => "1"})
>
> > How do I also join Codes?
>
> class User < AcrtiveRecord::Base
>   has_many :user_activities
> end
>
> class UserActivity < ActiveRecord::Base
>    belongs_to :user
>    belongs_to :code, :foreign_key => "activity_type"
> end
>
> Activity.find_all_by_user_id(1, :include => :code)
>
> This will return a collection of all of the activities for user#1 with
> attached instances of the code for each activity
>
> --
> 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: Joining Multiple Tables

by rubyonrailsin 0 comments
Thanks, but this doesn't seem to get me the fields from the Codes in
the ResultSet - and it also tries to do
activities.id = codes.id
when it should really be
activities.activity_type = codes.id
will keep looking - thanks though!

On Mar 30, 1:04 pm, Me <chabg...@gmail.com> wrote:
> joins => [:users_activities, :codes]
>
> On Mar 30, 2:03 pm, khagimoto <kumi.hagim...@gmail.com> wrote:
>
> > I'm trying to replicate a join in RoR that I can do in SQL very
> > simply.
>
> > Three tables/models that I have are: Users, Users_Activities,
> > Activities and Codes.
>
> > Users and Activities have appropriate has_many associations through
> > Users_Activities model, so it's easy to do a join to get all
> > activities for a given user.
>
> > Codes, on the other hand, is a different story.  It's kind of a
> > "repository" of all codified data.  For example, the Activity table
> > has a "Activity Type" field that is an integer field.  To get the
> > actual Activity Type name, you have to look it up in the Codes table
> > like so (joining with user table to get all activities for user id
> > "1"):
>
> > select activities.*, codes.name from activities, users_activities,
> > codes
> > where users_activities.user_id = 1
> >    and users_activities.activity_id = activities.id
> >    and activities.activity_type = codes.id
>
> > I can do part of the above query if i don't include the Codes table
> > like so:
>
> > Activity.all(:joins => :users_activities, :conditions =>
> > {'users_activities.user_id' => "1"})
>
> > How do I also join Codes?

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

by rubyonrailsin 0 comments
pl wrote:
> Hi John,
>
> More classes and instances will use more memory. Many websites uses
> Rails with these 3000+ classes in production, so that's not really a
> problem.
>
> What exactly is your question? You can disable parts of the Rails
> framework in your environment.rb, but that won't make a big
> difference.

Hi Pl,

Great to know many website use more than 3000+ classes.

Basically,
1. I will have huge numbers of tables and each one of them have totally
different columns. This because I want user to be able to upload theirs
own data/tables.
So, in this case, it can be even 20000+ classes.
2. For each tables, I will have model class that will access that table.

3. By having these no 1 and 2 requirement, I will need to load "model
classes" dynamically whenever a user import their own table without
restarting rails. So that's why I am looking into autoload feature. But
seems like autoload only loading it from file. It will not load based on
"string that contain model class"


--
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: Loading 3000 models to Ruby on Rails. Performances???

by rubyonrailsin 0 comments
Hi John,

More classes and instances will use more memory. Many websites uses
Rails with these 3000+ classes in production, so that's not really a
problem.

What exactly is your question? You can disable parts of the Rails
framework in your environment.rb, but that won't make a big
difference.

On 30 mrt, 23:25, John John <li...@ruby-forum.com> wrote:
> Hi,
>
> I just wandering. If I autoload 3000 Ruby on Rails classes, will it need
> more computer memory? is more rails classes loaded, more memory needed?
> will it cause performances problems?
>
> Thanks,
> John
> --
> 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.

Read More…

[Rails] Loading 3000 models to Ruby on Rails. Performances???

by rubyonrailsin 0 comments
Hi,

I just wandering. If I autoload 3000 Ruby on Rails classes, will it need
more computer memory? is more rails classes loaded, more memory needed?
will it cause performances problems?

Thanks,
John
--
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: ActionMailer Attachment : Character encoding for :filename

by rubyonrailsin 0 comments
Should I notify this bug somewhere ?
(I hope so!)

adrien

On Mar 28, 2:24 pm, Adrien Coquio <adrien.coq...@gmail.com> wrote:
> Hi,
>
> I want to send a file "joke.txt" with ActionMailer but I want to
> rename the file in the mail "député.txt"
> I set the parameters :filename of the attachment to "député.txt"
>
> But when I receive the mail I can see : "d put .txt"
>
> In the log :
> filename*=iso-2022-jp'ja'd%c3%a9put%c3%a9.txt
>
> How can I fix it ?
>
> Thanks for your answer :)
>
> adrien

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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] undefined local variable or method `request'—in test

by rubyonrailsin 0 comments
I am working on a small gem patch... The code in question is in a
module within /lib. I am calling request.env['HTTP_REFERER'] and
getting the desired results as implementation in the dev env.

However, when I run my RSpec spec, I get:
undefined local variable or method `request' for
#<Spec::Example::ExampleGroup::Subclass_1::Subclass_1:0x10057d518>

I am assuming that somehow "request" is not getting initialized when
in the test env. etc... Coming from the test/unit and Shoulda world, I
know very little about RSpec, perhaps this is playing a role in my
problem as well.

Any insight here?

Thanks!
Elliott G

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

Read More…

[Rails] Date checking ??

by rubyonrailsin 0 comments
Is there a method in Rails to see if a date is valid and in the last
120 years? I'm doing an app that has a list of people and I'd like to
check their birthdays. Just checking to see if this is already here
before i start coding it.


Thanks

Bob

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

by rubyonrailsin 0 comments
Gianluca Tessarolo wrote:
> Try this:
>
> @product = Product.find(:first, :conditions => ["title like ?",
> "%#{name}%"])
>
> Hope this helps...

Hey thanks this totally worked!!! I really appreciate the help
--
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] Fwd: simpe help needed - fixed

by rubyonrailsin 0 comments
perfect - thx


On Tue, Mar 30, 2010 at 4:25 PM, Colin Law <clanlaw@googlemail.com> wrote:
On 30 March 2010 19:23, tom <tomabroad@gmail.com> wrote:
> <%= job.id %>
>
>
> ---------- Forwarded message ----------
> From: tom <tomabroad@gmail.com>
> Date: Tue, Mar 30, 2010 at 2:21 PM
> Subject: simpe help needed
> To: rubyonrails-talk@googlegroups.com
>
>
> <p>
> <%= job.title %>
> <%= job.id %>
>
> <%= job.created_at %>
> </p>
>
>
>
> <div id="inner_content_ibox_#{job.id}" style="display:none;" >s
>
> <div style="background:#000000;color:#ffffff;border:1px dashed
> #FFFFFF;padding:15px;margin:15px;">
> </div>
> </div>
>
> gives me:
>
>
>
> <p>
>
> test123
> 7123
> 2010-02-23 17:53:49 UTC
> </p>
>
>
> <div id="inner_content_ibox_#{job.id}" style="display:none;" >s

Possibly something more like
<div id="inner_content_ibox_<%= job.id %>" style="display:none;" >s
would be better, or possibly
<%= "div id=\"inner_content_ibox_#{job.id}\" style=\"display:none;\"" >s

Colin

>
>
> <div style="background:#000000;color:#ffffff;border:1px dashed
> #FFFFFF;padding:15px;margin:15px;">
>
> </div>
> </div>
>
>
> what is wrong with the ID of the DIV?

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

Re: [Rails] Fwd: simpe help needed - fixed

by rubyonrailsin 0 comments
On 30 March 2010 19:23, tom <tomabroad@gmail.com> wrote:
> <%= job.id %>
>
>
> ---------- Forwarded message ----------
> From: tom <tomabroad@gmail.com>
> Date: Tue, Mar 30, 2010 at 2:21 PM
> Subject: simpe help needed
> To: rubyonrails-talk@googlegroups.com
>
>
> <p>
> <%= job.title %>
> <%= job.id %>
>
> <%= job.created_at %>
> </p>
>
>
>
> <div id="inner_content_ibox_#{job.id}" style="display:none;" >s
>
> <div style="background:#000000;color:#ffffff;border:1px dashed
> #FFFFFF;padding:15px;margin:15px;">
> </div>
> </div>
>
> gives me:
>
>
>
> <p>
>
> test123
> 7123
> 2010-02-23 17:53:49 UTC
> </p>
>
>
> <div id="inner_content_ibox_#{job.id}" style="display:none;" >s

Possibly something more like
<div id="inner_content_ibox_<%= job.id %>" style="display:none;" >s
would be better, or possibly
<%= "div id=\"inner_content_ibox_#{job.id}\" style=\"display:none;\"" >s

Colin

>
>
> <div style="background:#000000;color:#ffffff;border:1px dashed
> #FFFFFF;padding:15px;margin:15px;">
>
> </div>
> </div>
>
>
> what is wrong with the ID of the DIV?

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

by rubyonrailsin 0 comments
On 30 March 2010 19:20, Stephen None <lists@ruby-forum.com> wrote:
> I switched over to form_for as you suggested and that seems to be
> working much better but I am still running into a problem.  The form
> appears to be submitting the correct data but I am having a problem with
> selecting the record correctly.  Specifically, in my controller,
>
>  def update
>
>    @book = Book.find(:first, :conditions => ["barcode =
> ?",params[:barcode]])
>
>    @book.update_attributes(params[:book])
>    redirect_to "/books"
>
>  end
>
> If I replace the params[:barcode] with a real barcode (e.g.
> Book.find(:first, :conditions => {'barcode' => ['123456789']})) number
> the form processes successfully and updates my database.  When I try
> from the form however I am getting a null value error even though I can
> see the parameters being passed along in the logs so I am not sure why
> they are not available to the model...
>
> Processing BooksController#update (for 10.0.1.65 at 2010-03-30 14:01:07)
> [POST]
>  Parameters: {"commit"=>"Update", "action"=>"update",
> "authenticity_token"=>"vq6j9DJ57+AP4kbdbFHjeqeXHiYJDr9RT+zwHVCJ7mI=",
> "book"=>{"bounceback"=>"1", "barcode"=>"123456789"},
> "controller"=>"books"}

Look carefully at the params, you will see that you want
params[:book][:barcode] in your find.

You could have found this by using ruby-debug to break into your
controller where it is failing and inspecting the variables. See the
guide on debugging.

I would have expected to see an id there also, are you not passing the
record up to the view where the form_for is? Look at the code in the
controller#edit and view#edit and copy those except for missing out
the fields that you don't want in the view. Then you should get the
id also and can lookup on that rather than the barcode, which would be
more conventional. Unless I am misunderstanding exactly what you are
doing (which would not be unusual).

By the way, could you not 'top post' it would make it easier to follow
the thread. Thanks.

Colin

>
> [4;36;1mBook Load (0.6ms)[0m   [0;1mSELECT * FROM `books` WHERE (barcode
> = NULL) LIMIT 1[0m
>
> I have tried every combination of :conditions I can think of but I don't
> seem to be able to get it to work correctly.  Thanks!
>
> Stephen
>
> Colin Law wrote:
>> On 29 March 2010 21:44, Stephen None <lists@ruby-forum.com> wrote:
>>> the update page rather than just processing the update method.  I know
>>> <p>
>>>  <%= submit_tag "Update" %>
>>> </p>
>>> <% end -%>
>>
>> As I said it is easier to use the form_for method.  Just copy the
>> existing edit view code (which presumably includes the barcode and
>> checkout values) and remove from the form the fields that you do not
>> want.
>>
>> The problem with the submit is that you are not putting the data in
>> the params correctly.  Try doing an edit and look in development.log
>> to see what the params are, then do the same with yours and compare
>> them.  Your fields should be inside a hash for the complete object.
>> But  as I said if you use form_for it will all be done for you.  I
>> don't understand what problem you are having with form_for, what has
>> it got to do with loading the edit page?  You are using your new page
>> instead of the edit page in this case.
>>
>> Colin
>
> --
> 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…

Re: [Rails] Joining Multiple Tables

by rubyonrailsin 0 comments
On Tue, Mar 30, 2010 at 3:03 PM, khagimoto <kumi.hagimoto@gmail.com> wrote:
> I'm trying to replicate a join in RoR that I can do in SQL very
> simply.
>
> Three tables/models that I have are: Users, Users_Activities,
> Activities and Codes.
>
> Users and Activities have appropriate has_many associations through
> Users_Activities model, so it's easy to do a join to get all
> activities for a given user.
>
> Codes, on the other hand, is a different story.  It's kind of a
> "repository" of all codified data.  For example, the Activity table
> has a "Activity Type" field that is an integer field.  To get the
> actual Activity Type name, you have to look it up in the Codes table
> like so (joining with user table to get all activities for user id
> "1"):
>
> select activities.*, codes.name from activities, users_activities,
> codes
> where users_activities.user_id = 1
>   and users_activities.activity_id = activities.id
>   and activities.activity_type = codes.id
>
> I can do part of the above query if i don't include the Codes table
> like so:
>
> Activity.all(:joins => :users_activities, :conditions =>
> {'users_activities.user_id' => "1"})
>
> How do I also join Codes?

class User < AcrtiveRecord::Base
has_many :user_activities
end

class UserActivity < ActiveRecord::Base
belongs_to :user
belongs_to :code, :foreign_key => "activity_type"
end

Activity.find_all_by_user_id(1, :include => :code)

This will return a collection of all of the activities for user#1 with
attached instances of the code for each activity


--
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: Joining Multiple Tables

by rubyonrailsin 0 comments
joins => [:users_activities, :codes]

On Mar 30, 2:03 pm, khagimoto <kumi.hagim...@gmail.com> wrote:
> I'm trying to replicate a join in RoR that I can do in SQL very
> simply.
>
> Three tables/models that I have are: Users, Users_Activities,
> Activities and Codes.
>
> Users and Activities have appropriate has_many associations through
> Users_Activities model, so it's easy to do a join to get all
> activities for a given user.
>
> Codes, on the other hand, is a different story.  It's kind of a
> "repository" of all codified data.  For example, the Activity table
> has a "Activity Type" field that is an integer field.  To get the
> actual Activity Type name, you have to look it up in the Codes table
> like so (joining with user table to get all activities for user id
> "1"):
>
> select activities.*, codes.name from activities, users_activities,
> codes
> where users_activities.user_id = 1
>    and users_activities.activity_id = activities.id
>    and activities.activity_type = codes.id
>
> I can do part of the above query if i don't include the Codes table
> like so:
>
> Activity.all(:joins => :users_activities, :conditions =>
> {'users_activities.user_id' => "1"})
>
> How do I also join Codes?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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] Updating old extension from 0.6

by rubyonrailsin 0 comments
Hi,

I am a total Spree newbie, and there is an extension I would like to
use that hasn't been updated for a long time - it was written for
Spree 0.6, apparently. The extension can be found at
http://github.com/edmundo/spree-ps-spree-own-cart. Now, when I
install it, I get this error:

"Could not load extension from file: ps_spree_own_cart_extension.
#<MissingSourceFile: no such file to load -- application.rb>"

How could I go about fixing this? Any pointers on what I should look
for, relevant changes to Spree's architecture since 0.6 that I should
look for in the extension's code?

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…

[Rails] looking for a coutdown solution

by rubyonrailsin 0 comments
Hi,

i am looking for a coutdown solution. When a product is created in my
database a coutdown starts. The countdown is presented to visitors on my
website.

Someone ideas, links ?

grtz..remco
--
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: auto_complete: if no results returned, what gets submitted?

by rubyonrailsin 0 comments
Strange... What is the code you use to implement the autocomplete in the view?

/Lasse

2010/3/30 Wim Van Dijck <google@sinoid.be>
Hi Lasse,

thanks for repying.
I have the same for the controller and the view, not sure about the
action.

This is how set about to get there:
% script/generate scaffold_for_view supplier name:string street:string
streetnumber:decimal \
   zipcode:decimal city:string mail:string phone:string vat:string
% rake db:migrate
% gem sources -a http://gemcutter.org
% sudo gem install view_mapper
% ./script/plugin install git://github.com/rails/auto_complete.git
I add to the supplier model:
has_many :expenses

% script/generate scaffold_for_view expense title:string
amount:decimal payment:string \
   description:string category:string subcategory:string date:date --
view belongs_to_auto_complete:supplier

That's it. When I add some suppliers, I can autocomplete them in the
expense form, but when I use a name that's not found, it doesn't get
submitted.
The output of the server script is:
Processing ExpensesController#create (for 127.0.0.1 at 2010-03-30
11:26:31) [POST]
 Parameters: {"commit"=>"Create", "expense"=>{"date(1i)"=>"2010",
"subcategory"=>"test", "category"=>"test", "date(2i)"=>"3",
"title"=>"Test", "date(3i)"=>"29", "amount"=>"0.0", "payment"=>"test",
"supplier_name"=>"tester", "description"=>"test"},
"authenticity_token"=>"c845768fead94721c294f12ebc6f3b508e031398"}
 Supplier Load (0.2ms)   SELECT * FROM "suppliers" WHERE
("suppliers"."name" = 'tester') LIMIT 1
Rendering template within layouts/expenses
Rendering expenses/new
Rendered expenses/_form (78.5ms)
Completed in 183ms (View: 144, DB: 0) | 200 OK [http://localhost/
expenses]


Processing ExpensesController#create (for 127.0.0.1 at 2010-03-30
11:26:39) [POST]
 Parameters: {"commit"=>"Create", "expense"=>{"date(1i)"=>"2010",
"subcategory"=>"test", "category"=>"test", "date(2i)"=>"3",
"title"=>"Test", "date(3i)"=>"29", "amount"=>"0.01",
"payment"=>"test", "supplier_name"=>"", "description"=>"test"},
"authenticity_token"=>"c845768fead94721c294f12ebc6f3b508e031398"}
 Supplier Load (0.2ms)   SELECT * FROM "suppliers" WHERE
("suppliers"."name" = '') LIMIT 1
 Expense Create (34.4ms)   INSERT INTO "expenses" ("category",
"subcategory", "created_at", "title", "updated_at", "amount", "date",
"payment", "supplier_id", "description") VALUES('test', 'test',
'2010-03-30 09:26:39', 'Test', '2010-03-30 09:26:39', 0.01,
'2010-03-29', 'test', NULL, 'test')
Redirected to #<Expense:0x103d8e920>
Completed in 52ms (DB: 35) | 302 Found [http://localhost/expenses]

In the first block, the name is still there (tester), but in the
second, it isn't. Why would that be?

Many thanks,
Wim

On Mar 26, 7:28 pm, Lasse Bunk <lasseb...@gmail.com> wrote:
> Wim,
>
> I just tried it out, and it works fine for me – if I type a name that
> doesn't exist, then that name is submitted.
>
> In the controller:
>
>   auto_complete_for :supplier, :name
>
> In the action:
>
>   render :text => "Name = #{params[:supplier][:name]}"
>
> And in the view:
>
>   <%= text_field_with_auto_complete :supplier, :name %>
>
> If this doesn't help you, maybe you could post some code?
>
> /Lasse
>
> 2010/3/25 Wim Van Dijck <goo...@sinoid.be>
>
>
>
> > Hi,
>
> > I'm a rails noob, tring to teach myself, so feel free to point me to
> > the correct FM if need be ;-)
>
> > I'm playing with the auto_complete plugin. I have a page to manage
> > expenses, and there's field 'supplier' to whom the expense is paid.
> > I can successfully retrieve the suppliers name from the suppliers
> > table, but when I type a name that doesn't exist yet, and submit,
> > nothing gets submitted?
>
> > Can anyone shed any light to why that is?
> > Ideally, in this situation, I'd like to be redirected to the supplier
> > model 'new' page, but I can settle for it just accepting what I type?
>
> > Best regards,
> > Wim
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: 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<rubyonrails-talk%2Bunsubscrib e@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.


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

by rubyonrailsin 0 comments
Problem solved somewhat: I was supposed to paste the "new ..." code in
Firebug:Console, not a Command Window. I've still got a problem,
but I'll post it on a new thread.

On Mar 29, 3:34 am, RichardOnRails
<RichardDummyMailbox58...@USComputerGurus.com> wrote:
> I tried running the example in the text around Figures 4.1 , 4.2.  I'm
> running WinXP-Pro/SP3, Firefox 3.6.2, Firebug 1.5.3.  All the details
> are in the following Command Window results.  It's pretty obvious that
> "new" is not a regularly recognized Windows command,  but I don't know
> whether the author was running Unix, Linux, Mac OS or something else.
> BTW,  I think this book is a great tutorial.
>
> Thanks in Advance,
> Richard
>
> K:\>cd K:\_Projects\Ruby\_Rails_Apps\__PracticalPrototypeExamples
>
> K:\_Projects\Ruby\_Rails_Apps\__PracticalPrototypeExamples>JS_01.html
> [The Figure 4.1 window came up in Firefox 3.6.2, including the Firebug
> pane]
>
> K:\_Projects\Ruby\_Rails_Apps\__PracticalPrototypeExamples>new
> ajax.request('ajax.js', {method: 'get'})
> 'new' is not recognized as an internal or external command,
> operable program or batch file.
>
> K:\_Projects\Ruby\_Rails_Apps\__PracticalPrototypeExamples>type
> JS_01.html
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
>   <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
>   <script type="text/JavaScript" src="prototype.js"></script>
>   <title>JS_01</title>
> </head>
>
> <body>
>     <h1>Blank Page</h1>
>
> </body>
> </html>
>
> K:\_Projects\Ruby\_Rails_Apps\__PracticalPrototypeExamples>type
> ajax.js
> alert("Hello from Ajax.js");
>
> K:\_Projects\Ruby\_Rails_Apps\__PracticalPrototypeExamples>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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: [Radiant-Dev] [Proposal] Join forces to deal with extensions and Rails3

by rubyonrailsin 0 comments
I have several thoughts on how to approach this but the client work is
getting insane again. I'll take a rough stab at this sometime soon
and report back what I find. Basically I think we can use Rails3 for
most everything. We just need to understand more about the
limitations or gotchas that require additional spree/radiant hacks.
With any luck its nothing and this is just an exercise in proving
that.

Sean Schofield

On Mon, Mar 29, 2010 at 1:31 PM, Travis D Warlick Jr
<warlickt@operissystems.com> wrote:
> I think this is a wonderful idea.  In my walk-throughs of new Rails 3 code,
> I've noticed a number of things that Rails now has .  Count me in for help.
>
> I'd like to throw out an idea (which may require a new thread, but I'll
> start it here since it's closely related): Radiant/spree as a plugin gem.  I
> have a very large upcoming project.  It needs a CMS, but it also needs
> functionality that Radiant isn't the best choice for.  Currently, I'm forced
> to write two apps, which doesn't sit well with me.
>
> Here's my hypotheses on the benefits of using a plugin gem:
>
> * Passenger memory savings with smart spawning.
> * Built-in support for extension dependencies.
> * radiant command offload to rails -m <radiant-install-script>
>  - easy integration of "radiant-more" via install scripts?
>  - radiant-more install script repository, similiar to ext.radiantcms.org?
>
> Thoughts? Criticisms?
>
> -- Travis Warlick
>
> On 3/26/10 7:48 PM, Sean Schofield wrote:
>>
>> I'd like to introduce myself.  My name is Sean Schofield, and I'm the
>> creator of the Spree e-commerce project.  Spree has an extension
>> system very similar to the one in Radiant.  Actually we based our
>> extension system on the one in Radiant and received some very helpful
>> insight from Sean Cribbs at the time.
>>
>> Now that Rails3 is rolling around we're finding ourselves discussing
>> the future of extensions.  We're planning on taking a serious look at
>> this issue starting a few weeks from now.  One of the guys on the
>> Spree core team suggested that we might want to reach out to the
>> Radiant devs to see if they were interested in working together on
>> this problem.  A side benefit would be that it could become easier to
>> integrate Spree and Radiant for sites that require both e-commerce and
>> CMS.
>>
>> So I wanted to ask if there was any interest in working on a common
>> solution for implementing Radiant/Spree style extensions in Rails3.  I
>> was thinking we might want to create a separate github project for the
>> purposes of exploring this.  It could serve as a starting point for
>> exploring the concept but maybe it could evolve into a stand-alone gem
>> dependency that would work with Radiant or Spree.
>>
>> Is there any interest in exploring this together from the Radiant
>> community?
>>
>> Sean
>>
>
> --
> 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/
>
> To unsubscribe from this group, send email to
> radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the
> words "REMOVE ME" as the subject.
>

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

To unsubscribe from this group, send email to radiantcms-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

Read More…

[Rails] Joining Multiple Tables

by rubyonrailsin 0 comments
I'm trying to replicate a join in RoR that I can do in SQL very
simply.

Three tables/models that I have are: Users, Users_Activities,
Activities and Codes.

Users and Activities have appropriate has_many associations through
Users_Activities model, so it's easy to do a join to get all
activities for a given user.

Codes, on the other hand, is a different story. It's kind of a
"repository" of all codified data. For example, the Activity table
has a "Activity Type" field that is an integer field. To get the
actual Activity Type name, you have to look it up in the Codes table
like so (joining with user table to get all activities for user id
"1"):

select activities.*, codes.name from activities, users_activities,
codes
where users_activities.user_id = 1
and users_activities.activity_id = activities.id
and activities.activity_type = codes.id

I can do part of the above query if i don't include the Codes table
like so:

Activity.all(:joins => :users_activities, :conditions =>
{'users_activities.user_id' => "1"})

How do I also join Codes?

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

by rubyonrailsin 0 comments
On 30 March 2010 19:21, tom <tomabroad@gmail.com> wrote:
> <div id="inner_content_ibox_#{job.id}" style="display:none;" >
>
> what is wrong with the ID of the DIV?

The "job.id" call isn't inside Ruby delimiters, so it's just getting
rendered as HTML.
You want:

<div id="inner_content_ibox_<%=job.id%>" style="display:none;" >

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

by rubyonrailsin 0 comments
Hi Andrew,

I don't think this is too simple to use for Rails. You may want to
consider using Sinatra or a smaller web framework, but I wouldn't
write it in straight Ruby unless you want that experience.

As for how to do this in Rails, usually when you have a form it should
map to the "new" or "edit" controller actions. Here you are creating
tickets. The only exception is that if the ticket already exists in
the database you want to update the existing record. However, this
behavior still belongs in the create action because, from the
interface perspective, the user is still creating a ticket.

Whenever you're deciding whether a request should be POST (create) or
PUT (update), ask yourself this: if the user submits the same request
again, will the second request alter the database? When updating a
record you can submit the PUT request as many times as you like
without effecting the database much. In contrast if you submit a POST
request multiple times it will create multiple records. Here you're
incrementing a counter so the database changes each time the request
is submitted, therefore a POST (create) request is the right way to
go.

The create action might look like this.

def create
@ticket =
Ticket.find_or_initialize_by_number(params[:ticket_number])
@ticket.increment(:count) unless @ticket.new_record?
if @ticket.save
redirect_to @ticket
else
render :new
end
end

Everything else would be standard RESTful controller actions.

Hope that helps,

Ryan

On Mar 30, 10:18 am, partydrone <partydr...@gmail.com> wrote:
> I want to create a simple app.
>
> On one page, I want a form. This form has a single field for a ticket
> number. When someone enters a ticket number and submits the form, they
> are shown a second page with links to download files. And here is a
> list of other criteria:
>
> - validate ticket numbers (is a number within a certain range)
> - "used" tickets are stored in the database
> - if a ticket is not in the database, add it
> - if a ticket is in the database, increase "count" field by one
>
> This seems simple enough, but I don't quite understand how to take all
> of rails discrete processes (create using POST, update using PUT, show
> using GET, all in separate actions within a controller) and roll it
> all up into a single controller (or put it in the model, which makes
> sense).
>
> Should I scrap trying to use ActiveRecord and go to straight Ruby for
> this? I've never done database access straight from Ruby before.
>
> Here's the code:http://github.com/partydrone/ticket_check
>
> Any suggestions would be helpful. 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.

Read More…

[Rails] Fwd: simpe help needed - fixed

by rubyonrailsin 0 comments
<%= job.id %>


---------- Forwarded message ----------
From: tom <tomabroad@gmail.com>
Date: Tue, Mar 30, 2010 at 2:21 PM
Subject: simpe help needed
To: rubyonrails-talk@googlegroups.com


<p>
<%= job.title %>
<%= job.id %>
<%= job.created_at %>
</p>



<div id="inner_content_ibox_#{job.id}" style="display:none;" >s
<div style="background:#000000;color:#ffffff;border:1px dashed #FFFFFF;padding:15px;margin:15px;">
</div>
</div>

gives me:



<p>
test123
7123
2010-02-23 17:53:49 UTC
</p>


<div id="inner_content_ibox_#{job.id}" style="display:none;" >s
<div style="background:#000000;color:#ffffff;border:1px dashed #FFFFFF;padding:15px;margin:15px;">
</div>
</div>


what is wrong with the ID of the DIV?

thx


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

by rubyonrailsin 0 comments
<p>
<%= job.title %>
<%= job.id %>
<%= job.created_at %>
</p>



<div id="inner_content_ibox_#{job.id}" style="display:none;" >s
<div style="background:#000000;color:#ffffff;border:1px dashed #FFFFFF;padding:15px;margin:15px;">
</div>
</div>

gives me:



<p>
test123
7123
2010-02-23 17:53:49 UTC
</p>


<div id="inner_content_ibox_#{job.id}" style="display:none;" >s
<div style="background:#000000;color:#ffffff;border:1px dashed #FFFFFF;padding:15px;margin:15px;">
</div>
</div>


what is wrong with the ID of the DIV?

thx

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

by rubyonrailsin 0 comments
I switched over to form_for as you suggested and that seems to be
working much better but I am still running into a problem. The form
appears to be submitting the correct data but I am having a problem with
selecting the record correctly. Specifically, in my controller,

def update

@book = Book.find(:first, :conditions => ["barcode =
?",params[:barcode]])

@book.update_attributes(params[:book])
redirect_to "/books"

end

If I replace the params[:barcode] with a real barcode (e.g.
Book.find(:first, :conditions => {'barcode' => ['123456789']})) number
the form processes successfully and updates my database. When I try
from the form however I am getting a null value error even though I can
see the parameters being passed along in the logs so I am not sure why
they are not available to the model...

Processing BooksController#update (for 10.0.1.65 at 2010-03-30 14:01:07)
[POST]
Parameters: {"commit"=>"Update", "action"=>"update",
"authenticity_token"=>"vq6j9DJ57+AP4kbdbFHjeqeXHiYJDr9RT+zwHVCJ7mI=",
"book"=>{"bounceback"=>"1", "barcode"=>"123456789"},
"controller"=>"books"}

[4;36;1mBook Load (0.6ms)[0m [0;1mSELECT * FROM `books` WHERE (barcode
= NULL) LIMIT 1[0m

I have tried every combination of :conditions I can think of but I don't
seem to be able to get it to work correctly. Thanks!

Stephen

Colin Law wrote:
> On 29 March 2010 21:44, Stephen None <lists@ruby-forum.com> wrote:
>> the update page rather than just processing the update method.  I know
>> <p>
>>  <%= submit_tag "Update" %>
>> </p>
>> <% end -%>
>
> As I said it is easier to use the form_for method. Just copy the
> existing edit view code (which presumably includes the barcode and
> checkout values) and remove from the form the fields that you do not
> want.
>
> The problem with the submit is that you are not putting the data in
> the params correctly. Try doing an edit and look in development.log
> to see what the params are, then do the same with yours and compare
> them. Your fields should be inside a hash for the complete object.
> But as I said if you use form_for it will all be done for you. I
> don't understand what problem you are having with form_for, what has
> it got to do with loading the edit page? You are using your new page
> instead of the edit page in this case.
>
> Colin

--
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] Rounding problem

by rubyonrailsin 0 comments
what is the range of values that you're working with? 0 to 100, -3000 to 4000?



On 30 March 2010 04:21, JanneKo <janne.s.konttila@gmail.com> wrote:
Hi,

I have a strange problem with number rounding:
If I try "a_number.round(2)" in console - it works, but the same line
thru passenger fails: "wrong number of arguments (1 for 0)".
Any ideas why?

I'm running rails 2.3.4 and passenger 2.2.9

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




--
Charles A. Lopez
charlesalopez@gmail.com

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

Let's talk.
(IBM Partner)


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] jRails, jQuery, Hide (4 arguments)

by rubyonrailsin 0 comments
Is this the right forum to post this to?

In jRails.js there is a call to
hide
in which hide takes four parameters.

Where is that hide defined?
--
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] Newbie question - failed to allocate memory

by rubyonrailsin 0 comments
Hi,

I am pretty new in Ruby and Rails programming. I am trying to simply
output data of a really large table with many columns (around 30
columns) in an XML document using erb. I am able to loop through all the
records and output 2 columns. But when I add the following code to
output all the fields of every record the memory usage goes up a lot and
I get a failed to allocate memory error. Any idea why? Should I flush
the buffer? Should I disable the cache? Please help.

<% @records.each do |a| -%>
<% RecordClass.columns_hash.each do |key,value| -%>
<SimpleData name="<%= key -%>"><%= a[key] -%></SimpleData>
<% end -%>
<% end %>

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-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 haml in internationalisation with haml views

by rubyonrailsin 0 comments
I'm trying to use haml in my locale files but cant get it to parse.
en.yml
---------
page:
content: "
%p
some paragraph
%p
another paragraph
"

view.html.haml
------------------- (works)
=Haml::Engine.new(t('page.content)).render

-------------------(does not)
=t('page.content)

is the first example the only way to do this?
or am I going about this all wrong?

--
Rob Aldred
http://robaldred.co.uk

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

by rubyonrailsin 0 comments
I want to create a simple app.

On one page, I want a form. This form has a single field for a ticket
number. When someone enters a ticket number and submits the form, they
are shown a second page with links to download files. And here is a
list of other criteria:

- validate ticket numbers (is a number within a certain range)
- "used" tickets are stored in the database
- if a ticket is not in the database, add it
- if a ticket is in the database, increase "count" field by one

This seems simple enough, but I don't quite understand how to take all
of rails discrete processes (create using POST, update using PUT, show
using GET, all in separate actions within a controller) and roll it
all up into a single controller (or put it in the model, which makes
sense).

Should I scrap trying to use ActiveRecord and go to straight Ruby for
this? I've never done database access straight from Ruby before.

Here's the code: http://github.com/partydrone/ticket_check

Any suggestions would be helpful. 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.

Read More…

[Rails] Re: [ANN] Ruby Summer of Code 2010

by rubyonrailsin 0 comments
Hi jbw,

On Tue, Mar 30, 2010 at 9:02 AM, jbw <jbw@jbw.cc> wrote:
> On Tue, Mar 30, 2010 at 5:00 PM, jbw <jbw@jbw.cc> wrote:
>> On Tue, Mar 30, 2010 at 4:48 PM, Roger Pack <rogerpack2005@gmail.com> wrote:
>>> Jeremy Kemper wrote:
>>>> Fellow Rubyists, I'm proud to announce the first annual Ruby Summer of
>>>> Code.
>>>>
>>>> In the best tradition of Google's legendary summers of code, Ruby
>>>> Central, Engine Yard [1], and the Rails team [2] have joined forces to
>>>> muster a legend of our own, a new summer program for student Rubyists
>>>> to flex their open source might.
>>>>
>>>> * Students are paid a $5000 stipend to work full-time during their
>>>> summer break.
>>>
>>> One suggestion for future years might be to allow non-students.  Since
>>> 1) we're not google SoC so we can, and 2) if somebody can do it full
>>> time then why not...
>>>
>>
> I think the goal of getting younger developers involved in open source
> is important and allowing non-students might make it harder for
> younger developers, that's with the assumption all young people are
> students :p

College-student status is a measure that has worked well for Google so
we're cargo-culting and running with it this year. Primarily, it
filters out professional developers who would treat the program as a
three-month contract gig and gain nothing from it but a paycheck.

But, there are many paths to discovering the joys of Ruby and open
source participation. We're not huge fans of adding age and schooling
discrimination on top of that.

So perhaps we treat it like the Olympics: amateurs only.

Next year, I hope to see plumbers switching careers and retirees
unlearning COBOL, too!

jeremy

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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] object with many paperclip photos

by rubyonrailsin 0 comments
I have an object that has multiple photos uploaded to it, using the
paperclip plugin. I used a virtual attribute to have mutliple photos
in the form but I can't figure out how to get the image to save. It
works if I put <%= photo_form.file_field :image_file_name %> instead
of just :image. If I use just the following, the image_file_name
field is blank when it is saved.

<% for photo in @analysis.photos %>
<% fields_for "analysis[photo_attributes][]", photo do |photo_form|
%>
<p>
image description: <%= photo_form.text_field :description %>
<%= photo_form.file_field :image %>
</p>
<% end %>
<% end %>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] highcharts-rails from github not successfully installing

by rubyonrailsin 0 comments
Hey all,

I tried to install the highcharts-rails plugin from github as specified
in the instructions:

Installation

Get the plugin:

script/plugin install git://github.com/loudpixel/highcharts-rails.git

Run the rake setup:

rake highcharts_rails:install

But when I run the script/plugin install...
It installs a couple of files only and not all the required files, I
presume, because when I run
rake highcharts_rails:install
I get the following:
rake aborted!
Don't know how to build task 'highcharts_rails:install'

All it installed for me was:
jquery.js
jrails.js
jquery-ui.js

I noticed on the site http://github.com/loudpixel/highcharts-rails
It has all this:
file MIT-LICENSE February 08, 2010 Initial commit
[abbottry]
file README.md February 09, 2010 Added installation section
to README [jsiarto]
file Rakefile February 08, 2010 Initial commit [abbottry]
directory generators/ February 08, 2010 Initial commit
[abbottry]
file init.rb February 08, 2010 Initial commit [abbottry]
directory javascripts/ February 08, 2010 Added jquery 1.3.2
script [abbottry]
directory lib/ February 08, 2010 Initial commit [abbottry]
directory tasks/ February 08, 2010 Incorrect path to plugin
for rake task [abbottry]
directory test/ February 08, 2010 Initial commit [abbottry]
file uninstall.rb February 08, 2010 Initial commit
[abbottry]

So I'm not sure what I'm doing wrong to not get these files installed
properly. Thanks for any response.
--
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…

Subscribe feeds via e-mail

Blog Archive