rubyonrailsin

A Ruby and Rails talk

Tuesday, March 16, 2010

[Rails] Writing a large file with Spreadsheet: very slow, any HELP?

by rubyonrailsin 0 comments
Hey,

I'm using the Spreadsheet gem to generate Excel files. It's worked
great up until now.

I'm trying to put 25,000 rows in a sheet, then doing book.write to write
the file. It's really slow, like 3-4 minutes.

Is there a way to write groups of rows to a sheet at a time, or some
other way to speed up this process? Thanks in advance for any advice.
--
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: Recommendations for pdf generators

by rubyonrailsin 0 comments
i did before i posted. thanks


On 17 March 2010 00:47, Grary <grary.stimon@gmail.com> wrote:
...and see Ryan Bates' Railscast on prawn: http://railscasts.com/episodes/153-pdfs-with-prawn

Grar

--
You received 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: Before_filters on re-rendered methods - what is the correct RAILS way?

by rubyonrailsin 0 comments
render :action => :create only renders the template for the create
action, it doesnt run the actual action, thats why the before filter
doesnt get called.
Rendering actions and rendering templates are very similar. So simliar
that Im not sure why they arent merged into one.

Why are you going with one controller action and the if/elsif/else
solution instead of just separating steps into different controller
actions?
--
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] Re: Spree Heroku

by rubyonrailsin 0 comments
Is it possible to get Spree working with the free Piggy SSL addon?

I'm very interested in the free hosting possibility on Heroku for
development and testing phases.


Bruno.

-------------------------------------------------------------------------------------------------------------------------------------
Spree mailing list, this topic :
http://groups.google.com/group/spree-user/browse_thread/thread/4797e45d712b1c8a?hl=en
RestfulX mailing list, this topic :
http://groups.google.com/group/restfulx-framework/browse_thread/thread/c440c02b654e4c7d?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: SQL result to String conversion

by rubyonrailsin 0 comments
On 16 March 2010 19:33, Rohit Shinde <lists@ruby-forum.com> wrote:
> Can you please advice me a way to extract just the name from there?

This will give you what you want:
<%= User.find(:all, :select => 'name', :conditions => ["id = ?", 1]).name %>

...but there are so many poor and bad-practice things going on in that
line.... It's great that you've got as far as you have - to have
working models and views - but there's some large steps you need to
take that are covered well in lots of online references and in any of
the books that deal with getting started with Ruby/Rails.
I'd suggest visiting them and getting much more comfortable with the
basics to help you to get as quickly as possible to a position where
you will be able to produce useful code.

--
You received 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] updating rails apps via REST

by rubyonrailsin 0 comments
hi,

i have two rails-applications (similar inventory apps). they both use restful_auth.
now i got the request that one app needs to be able to update a record / create a new one in the other app. so basically what i would like to know is how do i post to the other app via REST including authentication?

any ideas are welcome.

tom


--
You received 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: SQL result to String conversion

by rubyonrailsin 0 comments
Thanks Fred.... when I view d page source.. I see something like this:
Created By (User): #<User:0x1042bbec0>

I guess this is hex representation of the memory point to the following
object <User id: 1, name: "Ron", created_at: "2010-03-15 02:45:28",
> updated_at: "2010-03-15 02:45:28">


Can you please advice me a way to extract just the name from there?


Frederick Cheung wrote:
> On Mar 16, 5:41�pm, Rohit Shinde <li...@ruby-forum.com> wrote:
>>
>> Now, when I run the server; the above line of code displays just the '#'
>> symbol.. nothing else (no name is displayed :-( ):
>> Created By (User): #
>>
>
> That's because all that is being stuck in the view is something like
>
> #<User id: 1, name: "Ron", created_at: "2010-03-15 02:45:28",
> updated_at: "2010-03-15 02:45:28">
>
> Which isn't legal html (you can verify this by viewing the html source
> in your browser)
>
> Fred

--
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: SQL result to String conversion

by rubyonrailsin 0 comments
On Mar 16, 5:41 pm, Rohit Shinde <li...@ruby-forum.com> wrote:
> Hello All,
>
> I am very new to Ruby on Rails and I have a quick question for you all,
> which is as follows:
>
> I have this following line of code in an partial that renders itself on
> the posts/index view:
> Created By (User): <%= User.find(:all, :select => 'name', :conditions =>
> ["id = ?", 1]) %>
> (I am hard-coding that '1' there)
>
> Now, when I run the server; the above line of code displays just the '#'
> symbol.. nothing else (no name is displayed :-( ):
> Created By (User): #
>

That's because all that is being stuck in the view is something like

#<User id: 1, name: "Ron", created_at: "2010-03-15 02:45:28",
updated_at: "2010-03-15 02:45:28">

Which isn't legal html (you can verify this by viewing the html source
in your browser)

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…

RE: [Radiant-Dev] Radiant as an extension to Radiant?

by rubyonrailsin 0 comments
Hello again,

I hate responding to myself, but it looks like warden[1] and url_mount[2] would be a good starting point for this, especially if radiant can be modified to rely on rails_warden[3] for authentication. We just need to write a rack application that uses warden and url_mount to handle "sites" or child rack applications.

[1]: http://github.com/hassox/warden
[2]: http://github.com/hassox/url_mount
[3]: http://github.com/hassox/rails_warden

Thanks,
-Scott

On Tuesday, March 16, 2010 1:58pm, "M. Scott Ford" <scott@vaderpi.com> said:

> Hi all,
>
> I thought I would introduce a wild idea I had this morning while thinking about
> multi-site implementations. One reason that I have not tried to use any of the
> existing multi-site extensions is I want to have really fine grained control over
> the gems and radiant extensions that are loaded for each site. (If there is a way
> to control this with the existing multi-site extensions, then please let me know
> how.)
>
> Radiant itself already handles controlling the extensions and gems loaded during
> startup. What if we added another layer to that logic, and created an extension
> that knows how to do the same thing but for site? So basically, Radiant core would
> just load the multi-site extension, and then every site would be what we now
> consider a Radiant instance. (If that makes any sense.)
>
> Another way to imagine this is to think about the multi-site functionality
> becoming the parent of Radiant core, instead of trying to fit a multi-site
> extension inside of Radiant (either directly in core or through extensions).
>
> I am not all that familiar with the core code-base, yet, so I am not sure if this
> is possible, but I thought I would pontificate and see what others think.
>
> Now that I have typed all of that out, though. It is starting to sound to me like
> these features might be best implemented as a rack middleware that Radiant can
> play nicely with. The middleware would own just sites and users, but radiant would
> own pages, layout, snippets, etc...
>
> I imagine that this would be useful to others in the Ruby community (if it has not
> already been done), and it would make it possible to have some sites that run
> rails apps, like radiant, others that are simple sinatra apps, and others that are
> instances of any other rack-based web solution.
>
> Thoughts?
> -Scott
>
> --
> 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…

[Rails] Re: validates_format_of

by rubyonrailsin 0 comments
Thanks my friend whit this my :price field is correct!

validates_format_of :precio, :with => /\A[0-9]{1,5}\.[0-9]{1,2}\Z/,
:message => ""


I love Rails!!
--
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: trying to install postgres gem on fedora 12 ..

by rubyonrailsin 0 comments
Jedrin wrote:
> I get these errors :
>
> gem install pg -- --with-pgsql-include-dir='/usr/include/pgsql' --
> with-pgsql-lib-dir='/usr/lib/pgsql'
> Building native extensions. This could take a while...
> ERROR: Error installing pg:
> ERROR: Failed to build gem native extension.
>
> /usr/bin/ruby extconf.rb --with-pgsql-include-dir=/usr/include/pgsql --
> with-pgsql-lib-dir=/usr/lib/pgsql
> can't find header files for ruby.
>
>
> Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/
> pg-0.9.0 for inspection.
> Results logged to /usr/lib/ruby/gems/1.8/gems/pg-0.9.0/ext/
> gem_make.out
>
>
> from yum list postgres*, the relevant stuff I have installed is:
>
> Installed Packages
> postgresql.i686
> 8.4.2-1.fc12 @updates
> postgresql-devel.i686
> 8.4.2-1.fc12 @updates
> postgresql-libs.i686
> 8.4.2-1.fc12 @updates
> postgresql-server.i686
> 8.4.2-1.fc12 @updates

I had same problem. But It's solved after run

yum install ruby-devel

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] collection_select has_many

by rubyonrailsin 0 comments
hi

i have two models:
GeoRegion & GeoRegionSub

which have a has_many relation to each other.

how can include the has_many relation in the collection_select helper? i want to have that dropdown where the parent is in black and the children indented.

<%= collection_select :dl,:parent_id, GeoRegion.all.????, :id, :title %>


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…

Re: [spree-user] Re: Spree Heroku

by rubyonrailsin 0 comments
SSL is my main concern at the moment. I'm going to talk with some
people at Heroku later today about it.

Sean Schofield

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

On Tue, Mar 16, 2010 at 12:59 PM, Fred <f.grosskopf@gmail.com> wrote:
> I used Heroku for another project, Spree on Heroku would definitely be
> great!
>
> On Mar 16, 1:36 pm, Sean Schofield <s...@railsdog.com> wrote:
>> I'm getting interested in Spree on Heroku again so we'll be revisiting
>> some of the current workarounds as well.
>>
>> Sean Schofield
>>
>> -------------------------------------------
>> Rails Dog LLC
>> 2 Wisconsin Circle, Suite 700
>> Chevy Chase, MD 20815
>> voice: (301)560-2000
>> -------------------------------------------
>>
>> On Tue, Mar 16, 2010 at 8:25 AM, Michel B <michel.bouchou...@gmail.com> wrote:
>> > Seems to be not so fluid.
>> > Thanks Roman.
>>
>> > On 16 mar, 12:14, Roman Smirnov <pom...@gmail.com> wrote:
>> >> Readhttp://blog.endpoint.com/2010/03/spree-heroku-development-environment...
>>
>> >> On Mar 16, 12:20 pm, Michel B <michel.bouchou...@gmail.com> wrote:
>>
>> >> > Hello,
>> >> > Does the extension Spree Heroku still work with the 0.10 versions of
>> >> > Spree ?
>>
>> >> > 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 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.
>
>

--
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: Get content from HTML element in Rails

by rubyonrailsin 0 comments
Peter De Berdt wrote:
> On 16 Mar 2010, at 16:44, Ignace S. wrote:
>
>> Anybody?
>> If more info is needed, do ask!
>> Thanks
>
> More info is needed
>
>
> Best regards
>
> Peter De Berdt

Little more specific? What exactly do you want to know?

Larry Meadors wrote:
> innerHtml is not a function.
>
> innerHTML is.
>
> Larry

Yes, you're right there, but as you can see, I use innerHTML in my
controller. And the same error message (but then with 'innerHTML') is
triggered.

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

[Radiant-Dev] Radiant as an extension to Radiant?

by rubyonrailsin 0 comments
Hi all,

I thought I would introduce a wild idea I had this morning while thinking about multi-site implementations. One reason that I have not tried to use any of the existing multi-site extensions is I want to have really fine grained control over the gems and radiant extensions that are loaded for each site. (If there is a way to control this with the existing multi-site extensions, then please let me know how.)

Radiant itself already handles controlling the extensions and gems loaded during startup. What if we added another layer to that logic, and created an extension that knows how to do the same thing but for site? So basically, Radiant core would just load the multi-site extension, and then every site would be what we now consider a Radiant instance. (If that makes any sense.)

Another way to imagine this is to think about the multi-site functionality becoming the parent of Radiant core, instead of trying to fit a multi-site extension inside of Radiant (either directly in core or through extensions).

I am not all that familiar with the core code-base, yet, so I am not sure if this is possible, but I thought I would pontificate and see what others think.

Now that I have typed all of that out, though. It is starting to sound to me like these features might be best implemented as a rack middleware that Radiant can play nicely with. The middleware would own just sites and users, but radiant would own pages, layout, snippets, etc...

I imagine that this would be useful to others in the Ruby community (if it has not already been done), and it would make it possible to have some sites that run rails apps, like radiant, others that are simple sinatra apps, and others that are instances of any other rack-based web solution.

Thoughts?
-Scott

--
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: [Radiant-Dev] Wy Radiant no longer deserves the "best ruby cms" title

by rubyonrailsin 0 comments
Thanks for everyone who chimed in. I think you guys did a good job of voicing what needed to be said. I didn't wish to give anyone the impression that they are not welcome.

All ideas are welcome all the time. If it's a good one, I'll be the first to jump on board. Sorry if I came on a little too strong, that's just my way. I only wanted to make the point that Mislav made, which is suggestions are fine, but also be willing to work on solving the issues yourself. I understand Rubybox doesn't have that much ruby experience so things that we think are easy projects to whip up might feel like huge task to her/him.

Rubybox I wish you'll stick around and help us improve Radiant. You've been helpful with the shop-extension voicing good ideas, and working on mockups. I think you could really help in the area of extension interfaces. So please don't be discouraged, just use whatever skills you have to contribute. You could help with updating the documentation or create new documentation for extensions things like that, until you get more comfortable with ruby. That's all.

Thanks,

Chris

 

On Tue, Mar 16, 2010 at 1:23 PM, John Long <johnwlong2000@gmail.com> wrote:
RubyBox--

As the creator Radiant CMS I'll weigh in a little here. :)

Radiant CMS was never intended to meet all of your needs out of the
box. One of the original principles was the 80% window. I wanted to
build a CMS that would work well for 80% of the web sites out there. I
pulled that number out of thin air, but the idea was that most web
sites are content focused -- not weblogs or portals. A lot of content
management systems tend to focus on one of these two domains to their
own detriment. I wanted to build something that gave me infinite
flexibility over how the content was displayed. That allowed me script
simple things like content indexes. Something that gave me the raw
materials to build a blog if needed, but didn't constrain me in any
way.

Since it was initially released most of the work done on Radiant CMS
has gone into making the extension system extremely viable. There have
been very few interface changes or new "features" added to the core
product. As I look back on this, the extension system was a bit of a
stop gap measure so that I wouldn't have to add all of the things that
people wanted me to add. But it has grown into probably the biggest
reason to choose Radiant CMS vs. other Rails-based content management
systems. There are now over 200 extensions in the registry. Show me
another Rails-based system that even comes close to this!

And this is the great strength of Radiant CMS. It is not the core code
base (though there are lots of things that I'm proud of there). It's
the community. The community has come together and created awesome
extensions for asset management, blogging, access control, and version
control -- just to name a few. Because Radiant is small it allows you
to bolt on the stuff that the core doesn't provide.

We have great plans for the future of Radiant. No it's not moving as
fast as we would all like it to, but 0.9 is will be a huge leap
forward and 0.10 will be even better.

So yes you are right, Radiant still has a long way to go, but don't
underestimate the power of the community. I still have my sights set
on Wordpress and some of the other systems out there. Radiant is not
quite ready to compete with them feature for feature, but it will be.
And we need the support of people within the community to make that
happen. You could be one of those folks if you stick around.

As to the "best CMS for Ruby" jab, I'll leave that for other folks to
judge. If Refinery suits your needs better, enjoy it.

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



On Tue, Mar 16, 2010 at 5:15 AM, rubybox <voorruby@gmail.com> wrote:
> If you just look at
>
> http://demo.refinerycms.com/
>
> You see they have lots of usability out of the box, where Radiant is a
> do-it-yourself
> Its really lacking essential features like a theme feature, things
> like (page order) drag and drop,
> a solid multi_site implementation as part of the core and other
> lacking features.
>
> For example see
> http://github.com/resolve/refinerycms/blob/master/vendor/plugins/themes/themes.md
>
> In my opinion after coming across this today and really looking into
> it ( saw it before but just quickly passed by )
> Radiant cannot no longer deserve the "state of the art" ruby on rails
> cms, that title definitly goes to
> Refinery, untill radiant gets improved and there is some serious
> activity on the github repro. Multisites is incoperated and the
> many issues from issuelist are solved. I know harsh words but Im not
> upto it yet, else I would.
>
> If refinery have/has multi_site I would definitly choose it over
> radiant untill I can build my own CMS based on radius.
> Any ideas?
>
> --
> 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…

[Rails] SQL result to String conversion

by rubyonrailsin 0 comments
Hello All,

I am very new to Ruby on Rails and I have a quick question for you all,
which is as follows:

I have this following line of code in an partial that renders itself on
the posts/index view:
Created By (User): <%= User.find(:all, :select => 'name', :conditions =>
["id = ?", 1]) %>
(I am hard-coding that '1' there)

Now, when I run the server; the above line of code displays just the '#'
symbol.. nothing else (no name is displayed :-( ):
Created By (User): #

I have the following tables: User, Post & Comment. For your reference, I
am also pasting here the contents of my 'User' table that I got from my
console:

>> User.find(:all)
=> [#<User id: 1, name: "Ron", created_at: "2010-03-15 02:45:28",
updated_at: "2010-03-15 02:45:28">, #<User id: 2, name: "David",
created_at: "2010-03-15 21:13:22", updated_at: "2010-03-15 21:13:22">,
#<User id: 3, name: "Tom", created_at: "2010-03-15 21:38:31",
updated_at: "2010-03-15 21:38:31">, #<User id: 4, name: "John",
created_at: "2010-03-15 21:38:43", updated_at: "2010-03-15 21:38:43">,
#<User id: 5, name: "Harry", created_at: "2010-03-15 21:38:50",
updated_at: "2010-03-15 21:38:50">, #<User id: 6, name: "Martin",
created_at: "2010-03-15 21:38:57", updated_at: "2010-03-15 21:38:57">]


Can you please let me me know if I am missing something here or if I am
doing anything wrong?
--
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] hooks and locals

by rubyonrailsin 0 comments
I've noticed some calls to hook like in admin order index.

<%- locals = {:order => order} -%>
<% hook :admin_orders_index_rows, locals do %>
<td><%= order.created_at.to_date%></td>
<td><%= link_to order.number, object_url(order) %></td>
<td><%= t(order.state.downcase) %></td>
<td><%= order.email %></td>
<td><%= number_to_currency order.total %></td>
<% end %>

Do I have access to the local passed in my_extension_hooks so I can do
some checks on it before I actually display the content?

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…

Re: [Radiant-Dev] Wy Radiant no longer deserves the "best ruby cms" title

by rubyonrailsin 0 comments
RubyBox--

As the creator Radiant CMS I'll weigh in a little here. :)

Radiant CMS was never intended to meet all of your needs out of the
box. One of the original principles was the 80% window. I wanted to
build a CMS that would work well for 80% of the web sites out there. I
pulled that number out of thin air, but the idea was that most web
sites are content focused -- not weblogs or portals. A lot of content
management systems tend to focus on one of these two domains to their
own detriment. I wanted to build something that gave me infinite
flexibility over how the content was displayed. That allowed me script
simple things like content indexes. Something that gave me the raw
materials to build a blog if needed, but didn't constrain me in any
way.

Since it was initially released most of the work done on Radiant CMS
has gone into making the extension system extremely viable. There have
been very few interface changes or new "features" added to the core
product. As I look back on this, the extension system was a bit of a
stop gap measure so that I wouldn't have to add all of the things that
people wanted me to add. But it has grown into probably the biggest
reason to choose Radiant CMS vs. other Rails-based content management
systems. There are now over 200 extensions in the registry. Show me
another Rails-based system that even comes close to this!

And this is the great strength of Radiant CMS. It is not the core code
base (though there are lots of things that I'm proud of there). It's
the community. The community has come together and created awesome
extensions for asset management, blogging, access control, and version
control -- just to name a few. Because Radiant is small it allows you
to bolt on the stuff that the core doesn't provide.

We have great plans for the future of Radiant. No it's not moving as
fast as we would all like it to, but 0.9 is will be a huge leap
forward and 0.10 will be even better.

So yes you are right, Radiant still has a long way to go, but don't
underestimate the power of the community. I still have my sights set
on Wordpress and some of the other systems out there. Radiant is not
quite ready to compete with them feature for feature, but it will be.
And we need the support of people within the community to make that
happen. You could be one of those folks if you stick around.

As to the "best CMS for Ruby" jab, I'll leave that for other folks to
judge. If Refinery suits your needs better, enjoy it.

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

On Tue, Mar 16, 2010 at 5:15 AM, rubybox <voorruby@gmail.com> wrote:
> If you just look at
>
> http://demo.refinerycms.com/
>
> You see they have lots of usability out of the box, where Radiant is a
> do-it-yourself
> Its really lacking essential features like a theme feature, things
> like (page order) drag and drop,
> a solid multi_site implementation as part of the core and other
> lacking features.
>
> For example see
> http://github.com/resolve/refinerycms/blob/master/vendor/plugins/themes/themes.md
>
> In my opinion after coming across this today and really looking into
> it ( saw it before but just quickly passed by )
> Radiant cannot no longer deserve the "state of the art" ruby on rails
> cms, that title definitly goes to
> Refinery, untill radiant gets improved and there is some serious
> activity on the github repro. Multisites is incoperated and the
> many issues from issuelist are solved. I know harsh words but Im not
> upto it yet, else I would.
>
> If refinery have/has multi_site I would definitly choose it over
> radiant untill I can build my own CMS based on radius.
> Any ideas?
>
> --
> 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: [Rails] Rails + Mysql

by rubyonrailsin 0 comments
2010/3/16 José Luis Romero <tangun73@gmail.com>:
> Hi... I'm a rails newb, trying to do some rails homework or sort of...
> I'm trying to run rails on Fedora 12... but it seems impossible...
> It's impossible to install the mysql gem...
Can you show the output for gem install mysql?

this is the last output
> when I tried to run a rake db:migrate:
> uninitialized constant MysqlCompat::MysqlRes
>
> Any suggestion?
>
> --
> You received 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.
>
>

--
Leonardo Mateo.
There's no place like ~

--
You received 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: what is the proper role of seed data?

by rubyonrailsin 0 comments
Robert,

Another high quality response, thank you.

Let me respond briefly, selectively to your reply...

> - The parameters x, y & z will be initialized to known values.
> - The values of x, y & z are normally fixed, but can be altered by users
> (administrators) at runtime.

Yes, very infrequently, e.g., once a year, parameters used as
constants in application computations will change and will need to be
changed by an administrator. So, these parameters are global.

> 1. Use a configuration file to store key/value pairs <...> Use a
> configuration file (YAML). If the administrator needs to change the
> configuration then just update the file with the new parameter. You will
> also like want to cache these values in some form of memory cache so you
> don't have to read the values from disk/database on every request. Take
> a look at memcached.

I agree with you that this is likely the best approach for my
situation.

Borrowing from http://railsforum.com/viewtopic.php?id=15295, I might
read/write to my file via the following mechanism:

a_config = YAML.load_file "#{RAILS_ROOT}/config/application.yml"
a_config["user"]["pwd_days"] = params[:days]
File.open("#{RAILS_ROOT}/config/application.yml", 'w') { |f|
YAML.dump(a_config, f) }

Look good?

Two final questions for you:

1. Regarding the use of memcached for efficiency, it is a efficiency
option available for flat file and database persisted data, alike,
right? So, I might look forward to its use in varied manner of
performance tuning?

2. > In all of these cases you could use seeds.rb to initialize your
values.

So, seeds is kind of like providing a user with a place to start,
e.g., standardized settings, that they may then wish to change? It is
not really for classic configuration, i.e., it does not involve global
settings.

Grar

--
You received 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: Spree Heroku

by rubyonrailsin 0 comments
I used Heroku for another project, Spree on Heroku would definitely be
great!

On Mar 16, 1:36 pm, Sean Schofield <s...@railsdog.com> wrote:
> I'm getting interested in Spree on Heroku again so we'll be revisiting
> some of the current workarounds as well.
>
> Sean Schofield
>
> -------------------------------------------
> Rails Dog LLC
> 2 Wisconsin Circle, Suite 700
> Chevy Chase, MD 20815
> voice: (301)560-2000
> -------------------------------------------
>
> On Tue, Mar 16, 2010 at 8:25 AM, Michel B <michel.bouchou...@gmail.com> wrote:
> > Seems to be not so fluid.
> > Thanks Roman.
>
> > On 16 mar, 12:14, Roman Smirnov <pom...@gmail.com> wrote:
> >> Readhttp://blog.endpoint.com/2010/03/spree-heroku-development-environment...
>
> >> On Mar 16, 12:20 pm, Michel B <michel.bouchou...@gmail.com> wrote:
>
> >> > Hello,
> >> > Does the extension Spree Heroku still work with the 0.10 versions of
> >> > Spree ?
>
> >> > 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 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: [Rails] Get content from HTML element in Rails

by rubyonrailsin 0 comments
innerHtml is not a function.

innerHTML is.

Larry


On Tue, Mar 16, 2010 at 6:25 AM, Ignace S. <lists@ruby-forum.com> wrote:
> Hey,
> I'm looking for a way to get the content of my div in my Rails view. I
> would like the literal HTML content, so only HTML and no Rails
> I thought inner_html would work, but I get a RJS exception (TypeError:
> $("content").innerHtml is not a function)
>
> Does anyone know how I can get the content? Thanks!
>
> In my controller I use this code:
> [code]
> def save_test
>    render :update do |page|
>        page['content'].innerHTML
>    end
> end
> [/code]
>
> Some more context maybe? I get a HTML form (without the form tags
> themselves) and put it into a rails form. What I want is that the user
> changes checkboxes, radiobuttons, fills out input fields etc and when
> the user saves, I want the literal changed content of the form as a
> string to save it to my database.
> The reason for this is that the several provided forms differ a lot and
> it's only used as information, no calculations etc need to be done on
> it.
> So my view looks like this:
>
> [code]
> form_remote_tag :url=>{:action => 'save_trainee_evaluation' do %>
> <div id="content">
>  <%= contract_trainer_trainee.evaluation_template %>
> </div>
> <%= submit_tag 'Opslaan' %>
>
> <% end %>
> [/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.
>
>

--
You received 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: Using group_to() and aggregation for a simple inventory system @ a field hospital in Haiti

by rubyonrailsin 0 comments
On 16 March 2010 15:57, Michael Pavling <pavling@gmail.com> wrote:
>> Also, is it possible to order the hash so that they appear in
>> descending order of how much of each item is in stock? In other words,
>> sort descending by the value that the following generates?
>>
>> <%=h "#{s.last.sum(&:amount_received) -
>> s.last.sum(&:amount_dispensed)}" %>
>

how about:

<%
@medicine.grouped_stocks.each_pair do |k, v|
v.sort_by {|stock| stock.amount_on_hand}.each do |stock|
%>
<%= "#{stock.medicine.name} #{stock.strength} #{stock.route.name}
#{stock.amount_on_hand}" %>
<%
end
end
%>

not sure if that will sort ascending or descending though... if it's
the wrong way round, you can always reverse before you .each...

--
You received 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] Re: Wy Radiant no longer deserves the "best ruby cms" title

by rubyonrailsin 0 comments
I checked under the hood of refinery and found some... interesting...
issues. Here is one for your enjoyment:

"Allow the site to have a login feature for non-administrative
"members". Preferably, different levels of account access rights and
permissions. All control in the backend under the same 'User' tab."

Haha. OK. Well, I think I'm too lazy to install and check it out.
Mainly because
- I don't like a large core source like they have
- the tabs, etc. look messy and cluttered
- There are other CMS systems that seem more promising
- Judging from the buglist, there are lots of ones not even opened
dating back 3 months- why have open source if they're not letting
folks manage and update the core?

cheers
Anna

--
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] more than one table per model

by rubyonrailsin 0 comments
Thanks everyone for all your insight. It was very helpful.

I was hoping to avoid dereferencing but I guess there's no way around
it. I will look into using has_one with a scheduled service for
updating the secondary table.

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…

Re: [Rails] Re: Get content from HTML element in Rails

by rubyonrailsin 0 comments

On 16 Mar 2010, at 16:44, Ignace S. wrote:

Anybody?
If more info is needed, do ask!
Thanks

More info is needed


Best regards


Peter De Berdt


Read More…

Re: [spree-user] Integrate PPE and Subscriptions

by rubyonrailsin 0 comments
Peter,
I think the natural place to store the profile_id is in the PaypalAccount model, as it's used as the payment source for all PPE transactions (it's the equivalent to the creditcard model in normal CC transaction).

BDQ

On 16 March 2010 15:32, Peter Kordel <pkordel@gmail.com> wrote:
I'm in the middle of merging together my forks of railsdog ppe and
subscriptions, going live today or tomorrow. I would be happy to hear
an opinion on where best to store the recurring payment profile id
returned from paypal.
I'm using code that extends active merchant to enable recurring
billing and the suggestion from the author is to store the returned
profile_id in a transactions table.
Since there have been extensive changes in the payment stuff as of
late, I would love to follow the suggested standard in edge, that way
I can open source all this when done.
Thanks in advance,
Peter K

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




--
Brian Quinn

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

--
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: HashWithIndifferentAccess remove inner hash question

by rubyonrailsin 0 comments
On 16 March 2010 15:24, Dudebot <craignied@gmail.com> wrote:
> On Mar 16, 10:15 am, Michael Pavling <pavl...@gmail.com> wrote:
>> Have a play with "delete_if" instead of the "each"...
>
> Thou art a genius!
>
> @morton[:new_lab_data_attributes].delete_if{ |x| x[ :value ].blank? }
>

It ain't me; it's the documentation...

My first port of call is always to type "ruby rails api <my problem>"
into Google.


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

Re: [Rails] Re: Using group_to() and aggregation for a simple inventory system @ a field hospital in Haiti

by rubyonrailsin 0 comments
On 16 March 2010 15:33, Clay H. <ccheaton@gmail.com> wrote:
> On Mar 16, 8:33 am, Michael Pavling <pavl...@gmail.com> wrote:
>>
>> And post again if you need any more help.
>
> Hey, thanks for the help so far. I went with a method in the
> Medicine.rb model file and I'm trying to display the results through
> the view, using code similar to what you suggested. I modified the
> code to appear as follows for now:

No worries (although if you're *not* working for a charity in Haiti
there's gonna be hell to pay!)

> def grouped_stocks
>  stocks.group_by{|s| [s.route.name, s.strength]}
> end
>
> The result is an ordered hash, correct? Here's some really ugly code
> in the view:
<snipped extremely ugly code>

You *can* do it by chopping up the key, but essentially you could't
care less about the key - it's just a method of grouping all the items
together how we want.

If you iterate down to the individual stocks arrayed inside the hash,
you should have access to everything you need from there:

<%
@medicine.grouped_stocks.each_pair do |k, v|
v.each do |stock|
%>
<%= "#{stock.medicine.name} #{stock.strength} #{stock.route.name}" %>
<%
end
end
%>


> Also, is it possible to order the hash so that they appear in
> descending order of how much of each item is in stock? In other words,
> sort descending by the value that the following generates?
>
> <%=h "#{s.last.sum(&:amount_received) -
> s.last.sum(&:amount_dispensed)}" %>

Good god man! :-)
erm... off the top of my head I don't know (as I hadn't played with
group_by until last night). Whether the .sort method works on the
OrderedHash (the API is eluding me at the moment), or whether you'd
need to extract the keys and totals to an array of arrays and sort
that by totals (so then rather than iterating grouped_stocks, you
access it by key taken from the sorted array), I don't know which...

Re-reading it: Does that make any sense?!

--
You received 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: Get content from HTML element in Rails

by rubyonrailsin 0 comments
Anybody?
If more info is needed, do ask!
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…

Re: [Rails] Re: Re: db change not reflected in app

by rubyonrailsin 0 comments
On Tue, Mar 16, 2010 at 8:19 AM, Jeff Ramin <lists@ruby-forum.com> wrote:

> Are there online tutorials you would recommend, for an experienced Java
> programmer who is new to ruby and rails?

Coming from a similar background, I've gotten a lot out of:

http://guides.rubyonrails.org/
http://railscasts.com/
http://peepcode.com/

and of course hanging out here and on the #ror irc channel :-)

HTH,
--
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] Losing Decimal scale from sqlite3 to mysql going from development to staging.

by rubyonrailsin 0 comments
I have been performing some testing between my development and staging
environments. I had noticed that the order.amount has been truncated.

All works fine in sqlite3 in development.

Here is the output: Amount is meant to be decimal (8,2) to support
pounds and pence (or dollars and cents).

class CreateOrders < ActiveRecord::Migration
def self.up
create_table :orders do |t|
t.integer :quote_id
t.integer :policyholder_id
t.string :ip_address
t.string :account_name
t.string :payment_type
t.string :last_digits
t.decimal :amount, :precision => 8, :scale => 2
t.string :cc_txncode
t.string :cc_securitykey
t.string :cc_card_type
t.timestamps
end
end

def self.down
drop_table :orders
end
end

If I check the table definition in sqllite (v 3.6.12) it looks
correct.

sqlite> .schema orders
CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT
NULL, "quote_id" integer, "policyholder_id" integer, "ip_address"
varchar(255), "account_name" varchar(255), "payment_type"
varchar(255), "last_digits" varchar(255), "amount" decimal(8,2),
"cc_txncode" varchar(255), "cc_securitykey" varchar(255),
"cc_card_type" varchar(255), "created_at" datetime, "updated_at"
datetime);

but the decimal amount gets changed to decimal(10,0) on the staging
mysql (Ver 5.0.67)

CREATE TABLE `orders` (
`id` int(11) NOT NULL auto_increment,
`quote_id` int(11) default NULL,
`policyholder_id` int(11) default NULL,
`ip_address` varchar(255) collate utf8_unicode_ci default NULL,
`account_name` varchar(255) collate utf8_unicode_ci default NULL,
`payment_type` varchar(255) collate utf8_unicode_ci default NULL,
`last_digits` varchar(255) collate utf8_unicode_ci default NULL
`amount` decimal(10,0) default NULL,
`cc_txncode` varchar(255) collate utf8_unicode_ci default NULL,
`cc_securitykey` varchar(255) collate utf8_unicode_ci default NULL,
`cc_card_type` varchar(255) collate utf8_unicode_ci default NULL,
`created_at` datetime default NULL,
`updated_at` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
COLLATE=utf8_unicode_ci;

Running on rails 2.3.5

Some of my decimal declarations are ok, even on the same table, some
work and some do not:

t.decimal :annual_price, :precision => 8, :scale => 2
t.decimal :monthly_price, :precision => 8, :scale => 2
t.string :status
t.date :policy_purchased_on
t.decimal :excess, :precision => 8, :scale => 2


`annual_price` decimal(8,2) default NULL,
`monthly_price` decimal(8,2) default NULL,
`status` varchar(255) collate utf8_unicode_ci default NULL,
`policy_purchased_on` date default NULL,
`excess` decimal(10,0) default NULL,


Any ideas as to what I am missing? Is it Rake?


Thanks,

O.

--
You received 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: Using group_to() and aggregation for a simple inventory system @ a field hospital in Haiti

by rubyonrailsin 0 comments
On Mar 16, 8:33 am, Michael Pavling <pavl...@gmail.com> wrote:
>
> And post again if you need any more help.

Hey, thanks for the help so far. I went with a method in the
Medicine.rb model file and I'm trying to display the results through
the view, using code similar to what you suggested. I modified the
code to appear as follows for now:

def grouped_stocks
stocks.group_by{|s| [s.route.name, s.strength]}
end

The result is an ordered hash, correct? Here's some really ugly code
in the view:
<%=h "#{s.first}" %>
This prints to screen as a concatenation of the two values in they key
of the hash item, like:

Oral Suspension100mg/5mL

There's no space between the two parts of the key.

So I tried this:

<%=h "#{s.first.first}" %>

This returns just the route name, which is good for display:
Oral Suspension

To return just the strength, I put this in place

<%=h "#{s.first.last}" %>

Which returns:
100mg/5mL

This strikes me as the wrong way to access these parts of the hash. Is
there a better way to do this?

What is the syntax for extracting a single component of the value part
of this hash? Let's say that I wanted to extract the strength from the
value part of the hash instead of the key part of the hash (since it
occurs in both).

I tried the following:

<%=h "#{s.last(:strength)}" %>
<%=h "#{s.last.first}" %>

and a few more, but since the value of the hash is an object, I always
see something like:
#<Stock:0x1032938e0>

What's the proper way to access attributes of the object that is
returned as the value of the hash?

Also, is it possible to order the hash so that they appear in
descending order of how much of each item is in stock? In other words,
sort descending by the value that the following generates?

<%=h "#{s.last.sum(&:amount_received) -
s.last.sum(&:amount_dispensed)}" %>

--
You received 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: DJ: Delayed Job Noob Question

by rubyonrailsin 0 comments
Chris Kalaboukis wrote:
> Hi guys: just got into Rails about a month ago and an about to launch
> something.
>
> I use Heroku and they limit the execution time of pages to 30 seconds. i
> have a process which takes a lot longer than that. So i'm trying to do a
> delayed job.
>
> The docs on delayed job must be for the pros out there cause I can't
> seem to find out the answers to a few simple questions..
>
> - where do i put the file with the job in it
> - what do i name it
> - how do i call it
> - how do I put it in the queue
> - can I run it say, every 5 minutes?
>
> Anyways, hope someone out there can help me out...
>
> Thanks...Chris

This railscast should answer your first few questions -
http://railscasts.com/episodes/171-delayed-job

I'm using DJ on Heroku and I'm running jobs in a recurring fashion. I
kick things off from the console. I just call some methods that I wrote
that do nothing but enqueue some jobs. I have the recurring jobs
re-enqueue themselves upon completion. Here's an example:

def enqueue_media_cleanup
#this is what I run from the Heroku console
Delayed::Job.enqueue ClearOldEventsJob.new(), 0, 15.minutes.from_now
Delayed::Job.enqueue DumpOldMediaJob.new(), 0, 2.minutes.from_now
end

def purge_expired_events

#some code to do some stuff...

#ClearOldEventsJob just runs/calls purge_expired_events
Delayed::Job.enqueue ClearOldEventsJob.new(), 0, 6.hours.from_now

end

There are other ways to do it but this has been working well for me.
--
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] Integrate PPE and Subscriptions

by rubyonrailsin 0 comments
I'm in the middle of merging together my forks of railsdog ppe and
subscriptions, going live today or tomorrow. I would be happy to hear
an opinion on where best to store the recurring payment profile id
returned from paypal.
I'm using code that extends active merchant to enable recurring
billing and the suggestion from the author is to store the returned
profile_id in a transactions table.
Since there have been extensive changes in the payment stuff as of
late, I would love to follow the suggested standard in edge, that way
I can open source all this when done.
Thanks in advance,
Peter K

--
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: HashWithIndifferentAccess remove inner hash question

by rubyonrailsin 0 comments
On Mar 16, 10:15 am, Michael Pavling <pavl...@gmail.com> wrote:
> Have a play with "delete_if" instead of the "each"...

Thou art a genius!

@morton[:new_lab_data_attributes].delete_if{ |x| x[ :value ].blank? }

Works. *Many, many* 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…

[Rails] Re: HashWithIndifferentAccess remove inner hash question

by rubyonrailsin 0 comments
On Mar 16, 10:11 am, Michael Pavling <pavl...@gmail.com> wrote:

> It was your syntax! :-) I just changed "== nil" to ".blank?"
> Look at the docs for Hash:http://ruby-doc.org/core/classes/Hash.html#M002870
>
> Looks like just dropping the "if" would work...

Oops, you were right about that (I'm so addled by trying different
things at this point, that I'm not seeing the obvious) but it still
doesn't work:

@morton[:new_lab_data_attributes].each{ |x| x.delete
x[ :value ].blank? }
raise @morton.to_yaml

--- !map:HashWithIndifferentAccess
new_lab_data_attributes:
- !map:HashWithIndifferentAccess
unit_id: "4"
lab_desc_id: "3"
value: ""
- !map:HashWithIndifferentAccess
unit_id: "2"
lab_desc_id: "2"
value: ""

--
You received 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: db change not reflected in app

by rubyonrailsin 0 comments
Hassan Schroeder wrote:
> On Tue, Mar 16, 2010 at 7:55 AM, Jeff Ramin <lists@ruby-forum.com>
> wrote:
>
>> According to "Agile Web Development with Rails", the field should
>> automagically appear on views, but that was using rails 1.2 and using
>> scaffold in the controller. I'm running rails 2.3.x, so wasn't able to
>> use "scaffold" in the way described in the book.
>
> You're setting yourself up for continuous pain and frustration by using
> an out-of-date reference with a current Rails version.
>
> Toss that book and get the latest, or use online tutorials based on the
> 2.3.x branch. Really.
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
> twitter: @hassan

Ok - thanks for the warning.

Are there online tutorials you would recommend, for an experienced Java
programmer who is new to ruby and rails?
--
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: Re: db change not reflected in app

by rubyonrailsin 0 comments
Michael Pavling wrote:
> On 16 March 2010 14:55, Jeff Ramin <lists@ruby-forum.com> wrote:
>> According to "Agile Web Development with Rails", the field should
>> automagically appear on views, but that was using rails 1.2 and using
>> scaffold in the controller. I'm running rails 2.3.x, so wasn't able to
>> use "scaffold" in the way described in the book.
>>
>> Does that explain the (mis)behavior?
>
> Which version of the book have you got?! If it's v2 or earlier, lots
> of it is going to be wrong for the version you have installed, which
> is going to be very frustrating at times.

2nd edition, 2006.

>
>
> But yes - the scaffolding used to loop through all the columns :
>
> <% for column in License.content_columns %>
> <p>
> <b><%= column.human_name %>:</b> <%=h @license.send(column.name) %>
> </p>
> <% end %>
>
> ...but that's intensely annoying because you have to *totally* remove
> it to replace it with anything useful.
>
> Now, the individual fields get rendered one after an other - so you
> can tweak the scaffolded file, rather than re-write it completely.
>
> (of course the down side is if you add a new field to the db, you have
> to add it to the view)

Thank you.

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

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

Read More…

Re: [Rails] Re: HashWithIndifferentAccess remove inner hash question

by rubyonrailsin 0 comments
On 16 March 2010 15:11, Michael Pavling <pavling@gmail.com> wrote:
> Looks like just dropping the "if" would work...

*sigh* no it won't... there's an extra .each iterator in there....

Have a play with "delete_if" instead of the "each"...

--
You received 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: db change not reflected in app

by rubyonrailsin 0 comments
On Tue, Mar 16, 2010 at 7:55 AM, Jeff Ramin <lists@ruby-forum.com> wrote:

> According to "Agile Web Development with Rails", the field should
> automagically appear on views, but that was using rails 1.2 and using
> scaffold in the controller. I'm running rails 2.3.x, so wasn't able to
> use "scaffold" in the way described in the book.

You're setting yourself up for continuous pain and frustration by using
an out-of-date reference with a current Rails version.

Toss that book and get the latest, or use online tutorials based on the
2.3.x branch. Really.

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

Re: [Rails] Re: HashWithIndifferentAccess remove inner hash question

by rubyonrailsin 0 comments
On 16 March 2010 15:01, Dudebot <craignied@gmail.com> wrote:
> On Mar 16, 9:29 am, Michael Pavling <pavl...@gmail.com> wrote:
>
>> You could try "blank?" (it might work):
>>   @morton[:new_lab_data_attributes].each{ |x| x.delete if x[:value].blank? }
>
> I'm just lost with this syntax :)  delete complains if it doesn't have
> an argument, so I tried

It was your syntax! :-) I just changed "== nil" to ".blank?"
Look at the docs for Hash:
http://ruby-doc.org/core/classes/Hash.html#M002870

Looks like just dropping the "if" would work...

--
You received 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: db change not reflected in app

by rubyonrailsin 0 comments
On 16 March 2010 14:55, Jeff Ramin <lists@ruby-forum.com> wrote:
> According to "Agile Web Development with Rails", the field should
> automagically appear on views, but that was using rails 1.2 and using
> scaffold in the controller. I'm running rails 2.3.x, so wasn't able to
> use "scaffold" in the way described in the book.
>
> Does that explain the (mis)behavior?

Which version of the book have you got?! If it's v2 or earlier, lots
of it is going to be wrong for the version you have installed, which
is going to be very frustrating at times.


But yes - the scaffolding used to loop through all the columns :

<% for column in License.content_columns %>
<p>
<b><%= column.human_name %>:</b> <%=h @license.send(column.name) %>
</p>
<% end %>

...but that's intensely annoying because you have to *totally* remove
it to replace it with anything useful.

Now, the individual fields get rendered one after an other - so you
can tweak the scaffolded file, rather than re-write it completely.

(of course the down side is if you add a new field to the db, you have
to add it to the view)

--
You received 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: HashWithIndifferentAccess remove inner hash question

by rubyonrailsin 0 comments
On Mar 16, 9:29 am, Michael Pavling <pavl...@gmail.com> wrote:

> You could try "blank?" (it might work):
>   @morton[:new_lab_data_attributes].each{ |x| x.delete if x[:value].blank? }

I'm just lost with this syntax :) delete complains if it doesn't have
an argument, so I tried

@morton[:new_lab_data_attributes].each{ |x| x.delete(x) if
x[:value].blank? }

Which still isn't deleting anything...

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

Read More…

[Rails] Re: db change not reflected in app

by rubyonrailsin 0 comments
Michael Pavling wrote:
> On 16 March 2010 14:35, Jeff Ramin <lists@ruby-forum.com> wrote:
>> However, from what I've read, this new column should immediately be
>> reflected in the app; in other words, when I create a new widget in the
>> app, a new form field should appear on the page. But, this isn't
>> happening.
>
> Being "reflected in the app" and appearing on the page are two different
> things.
>
> The field *is* available as a method on the model, but it's not going
> to appear on any page (other than a list that is iterating through all
> the model's columns) unless you put it there. It would be highly
> annoying if every time you added a field it appeared randomly on views
> :-)
>
> You need to edit the view file (the erb, or rhtml if it's an older
> version of Rails) and put the HTML to display the field you've created
> wherever you want it to appear.
>
> if you want to be *sure*, you can add <%= @model.my_new_field %>
> anywhere in the view, and edit a record in the DB - refresh to see
> your DB-edited value.

Thanks.

According to "Agile Web Development with Rails", the field should
automagically appear on views, but that was using rails 1.2 and using
scaffold in the controller. I'm running rails 2.3.x, so wasn't able to
use "scaffold" in the way described in the book.

Does that explain the (mis)behavior?

--
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] db change not reflected in app

by rubyonrailsin 0 comments
On 16 March 2010 14:35, Jeff Ramin <lists@ruby-forum.com> wrote:
> However, from what I've read, this new column should immediately be
> reflected in the app; in other words, when I create a new widget in the
> app, a new form field should appear on the page. But, this isn't
> happening.

Being "reflected in the app" and appearing on the page are two different things.

The field *is* available as a method on the model, but it's not going
to appear on any page (other than a list that is iterating through all
the model's columns) unless you put it there. It would be highly
annoying if every time you added a field it appeared randomly on views
:-)

You need to edit the view file (the erb, or rhtml if it's an older
version of Rails) and put the HTML to display the field you've created
wherever you want it to appear.

if you want to be *sure*, you can add <%= @model.my_new_field %>
anywhere in the view, and edit a record in the DB - refresh to see
your DB-edited value.

--
You received 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: Upgrading a 1.1.2 RoR App

by rubyonrailsin 0 comments
On Mar 16, 2010, at 9:34 AM, Roch Delsalle wrote:

> Hi,
>
> Thanks for your answer, I'm going to try that.
> What do you mean by "if you can vendor rails into your repository" ?
> Is it still possible to run a 1.1.2 Rails App on Heroku or any other
> RoR Hosting?
>
> Regards,
>
> Roch

You can freeze rails:

rake rails:freeze:gems # Lock this application to the
current gems (by unpacking them into vendor/rails)

You might also have to freeze your gems (so they appear like plugins)
if the hosting service doesn't have the versions you need and won't
install them for you.

Now, whether any particular hosting company will support that config
is beyond my knowledge.

-Rob

>
> On Mar 16, 2:40 am, Rob Biedenharn <R...@AgileConsultingLLC.com>
> wrote:
>> On Mar 15, 2010, at 4:15 PM, Roch Delsalle wrote:
>>
>>> Hi,
>>
>>> I have been running a 1.1.2 RoR app for a few years without
>>> upgrading.
>>> I'm now forced to move it since we the current hosting plan is
>>> ending.
>>> I would like to know what would be the best way to do it since it
>>> has
>>> changed a lot. At the time I was using the localization plugin, and
>>> some really old things.
>>
>>> Thanks
>>
>> Yikes! And I thought I had an old app in production on Rails 1.2.2
>>
>> Depending on how "big" it is, you might find it easier to rewrite it
>> for 2.3.5 or even jump on 3.0.beta.
>>
>> To "upgrade", the path looks something like:
>>
>> 1.1.2 => (1.1.6 =>) 1.2.0 => 1.2.6 => (2.x =>) 2.3.5
>>
>> You might not need to hit 1.1.6, but gobs of stuff changed in 1.2.0
>> so
>> that's probably a good bet. Whether you need to hit 2.x (where x is
>> probably 0) might be debatable, but 1.2.6 should have the deprecation
>> warning for the bigger changes in 2.0.
>>
>> This assumes that you have good test coverage.
>>
>> And rewriting would be really hard (for whatever reason).
>>
>> Of course, if you can vendor rails into your repository, you might be
>> able to use 1.1.2 even longer. In my case, I have that 1.2.2 app
>> running under Passenger with ruby-1.8.7 and only had a few minor
>> issues getting Rails to run on that version (mostly due to iteration
>> over strings by character--something that ActiveSupport added, but
>> 1.8.7 has baked-in).
>>
>> Good luck!
>>
>> -Rob
>>
>> Rob Biedenharn http://agileconsultingllc.com
>> R...@AgileConsultingLLC.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-
> talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
> .
>

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
+1 513-295-4739
Skype: rob.biedenharn


--
You received 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] db change not reflected in app

by rubyonrailsin 0 comments
Hi folks.

I'm just starting to learn ruby and rails, and I'm working through a
tutorial.

I've hit a hurdle attempting to add a column to a table. I've created
the migration file and ran it through rake, and I can see that the db
(mysql) has changed.

However, from what I've read, this new column should immediately be
reflected in the app; in other words, when I create a new widget in the
app, a new form field should appear on the page. But, this isn't
happening.

Can anybody explain why? 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…

Re: [spree-user] Re: Integrating Spree with an existing site

by rubyonrailsin 0 comments
Is you existing app Rails or not? If its not rails, then its pretty
easy b/c you can run spree as /store as you are asking and have
Passenger only map the /store stuff to Rails and leave things alone
(for your PHP or whatever) to handle in the document root.

You can test running as /store locally by doing the following:
script/server --path=/store

Sean Schofield

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

On Mon, Mar 15, 2010 at 11:36 PM, Danny <dclark@pobox.com> wrote:
> On Mar 11, 1:06 pm, Christopher Maujean <cmauj...@gmail.com> wrote:
>> I would run it as a different app, and use DNS or url rewriting at the
>> web server level. I'd also use store.mysite.com instead of using
>> /store.
>
> Does spree not support being at something other than the root?
>
> Additional SSL certificates aren't so expensive, but additional IP
> addresses you need to use them are sometimes vaguely expensive or just
> not possible to get.
>
> --
> Daniel JB Clark | http://pobox.com/~dclark | Activist; Owner
>           \|/
>   FREEDOM -+-> INCLUDED ~ http://freedomincluded.com
>           /|\
> Free Software respecting hardware ~ Lemote Yeeloong reseller
>
> --
> 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…

Subscribe feeds via e-mail

Blog Archive