rubyonrailsin

A Ruby and Rails talk

Wednesday, March 31, 2010

Re: [spree-user] newsletter extension

by rubyonrailsin 0 comments
try madmimi and embed their form.

On Wed, Mar 31, 2010 at 2:00 PM, lesfreeman <lesliefreeman3@gmail.com> wrote:
Hello,
Does anyone know if there is an extension available to handle
newsletter signups during the checkout process?

Thanks,
Les

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

[spree-user] Re: Problems with contact_us extensions

by rubyonrailsin 0 comments
BTW - I upgraded to Spree 0.10.2 and same thing... doesn't work.
Installed it for another project from scratch - same thing, doesn't
work.

On Mar 5, 1:59 pm, Roman Smirnov <pom...@gmail.com> wrote:
> I think at this moment edge is more stable than 0.9.2 :-)
> Just b/c 0.10.0 will be released at this week and it have many fixes
> of bugs, which active in 0.9.x versions.
>
> On Mar 5, 8:34 am, arhar <zavu...@gmail.com> wrote:
>
> > Ah, that would explain.. I had a suspicion... Are there any
> > alternatives out there that would work with prod-stable Spree? We need
> > to go live in about a week
>
> > On Mar 5, 12:10 am, Alexander Negoda <alexander.neg...@gmail.com>
> > wrote:
>
> > > > I'm having problems withcontact_usextension:
> > > >http://github.com/greendog/spree_contact_us.
> > > > I'm using Spree v0.9.2
>
> > > This extension to edge-version

--
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: Catch the browser close event

by rubyonrailsin 0 comments
bill walton wrote:
> Hello Hiro,
>
> On Mon, 2009-03-02 at 08:04 -0800, Hiro wrote:
>
>> Is there a way to catch the browser close event?
>
> There is no reliable way to do this.
>
>> I want it to end the users session, because if the
>> user close the browser and try to sign in, I get the
>> "user already logged" message.
>
> Do you want closing the browser to end the user's session? Or are you
> just wanting to avoid the user trying to sign in and getting an error
> message when they already have a valid session and don't need to sign
> in? The first is difficult. The second, easy. Let us know.
>
> Best regards,
> Bill

Bill...
I'm trying to have the user session expire on a browser close. Is there
an easy way of doing that?
--
Posted via http://www.ruby-forum.com/.

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

Read More…

[spree-user] Re: undefined method link_to in extension hooks file

by rubyonrailsin 0 comments
Answer to my own question. Stuff in hooks should be text, which will
later be parsed as erb in the view:

insert_after(:admin_configurations_menu) do
'<tr>
<td><%= link_to t("rent_a_cop_management_link"), "/" %></td>
<td><%= t("rent_a_cop_description") %></td>
</tr>'
end

On Mar 31, 1:30 pm, lesfreeman <lesliefreem...@gmail.com> wrote:
> In my extension hooks file I am trying to add a link to the config
> menu:
>
> class RentACopHooks < Spree::ThemeSupport::HookListener
>
>   insert_after :admin_configurations_menu do
>     '<tr><td>'+link_to(I18n.t("rent_a_cop_management_link"), '/')+'</
> td><td>'+I18n.t("rent_a_cop_description")+'</td></tr>'
>   end
>
> end
>
> It works fine if I take out the link_to and just put in normal text,
> but with the link_to I get an undefined method error.
>
> I tried adding an include ActionView::Helpers::UrlHelper to no avail.
>
> The example code shows:
> insert_after :product_description do
>      '<p>' + link_to('Back to products', products_path) + '</p>'
>     end
>
> Which, when I uncomment it and go to the products page, gives an
> undefined method error for products_path.
>
> What am I missing?
>
> Thanks
> Les

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

Read More…

[spree-user] undefined method link_to in extension hooks file

by rubyonrailsin 0 comments
In my extension hooks file I am trying to add a link to the config
menu:

class RentACopHooks < Spree::ThemeSupport::HookListener

insert_after :admin_configurations_menu do
'<tr><td>'+link_to(I18n.t("rent_a_cop_management_link"), '/')+'</
td><td>'+I18n.t("rent_a_cop_description")+'</td></tr>'
end

end

It works fine if I take out the link_to and just put in normal text,
but with the link_to I get an undefined method error.

I tried adding an include ActionView::Helpers::UrlHelper to no avail.

The example code shows:
insert_after :product_description do
'<p>' + link_to('Back to products', products_path) + '</p>'
end

Which, when I uncomment it and go to the products page, gives an
undefined method error for products_path.

What am I missing?

Thanks
Les

--
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: [spree-user] Sagepay (protx) error when trying to use undefined method `authorize'

by rubyonrailsin 0 comments
can you paste in the first 20 lines of the backtrace?

Paul

On Wed, Mar 31, 2010 at 5:26 PM, lostcaggy <martin@domeweb.co.uk> wrote:
get error message when trying to make a purchase
undefined method `authorize'

can someone give me an idea of what I need to do to fix it
Thanks
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.


--
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: RMagick, ImageMagick, Passenger and Dreamhost

by rubyonrailsin 0 comments
I had the same problem on Ubuntu, and

$sudo apt-get install librmagick-ruby1.8

did the trick for me. Hope this helps anybody.
--
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: incompatible character encodings: ASCII-8BIT and UTF-8

by rubyonrailsin 0 comments
Gudleik Rasch wrote:
> I've been struggling with the same issue a few times, and the solution
> that worked for me was to use a different mysql driver: ruby-mysql
>
> # in config/environment.rb:
> config.gem 'ruby-mysql'
>
> # or in Gemfile:
> gem 'ruby-mysql'
>
> The encoding must also be set in config/database.yml:
> adapter: mysql
> encoding: utf8

Hey,

First of all thanks but I tried what you said and well...
gem install ruby-mysql
config/environment.rb: added config.gem 'ruby-mysql'
config/database.yml: added adapter: mysql, encoding: utf8

But when I start the server I get following error:
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
D:/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning:
Gem::Dependency#version_requirements is deprecated and will be removed
on or after August 2010. Use #requirement
no such file to load -- ruby-mysql
...
D:/ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
`require'Missing these required gems:
ruby-mysql

You're running:
ruby 1.9.1.378 at D:/ruby19/bin/ruby.exe
rubygems at D:/ruby19/lib/ruby/gems/1.9.1

Run `rake gems:install` to install the missing gems.

I of course tried rake gems:install but it didn't help. I also tried to
just uninstall the mysql gem but that didn't work either. Any idea?
--
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: unitialized constant

by rubyonrailsin 0 comments
David wrote:
> Did you run the rake task after you installed the plugin?

Yeah, I ran
rake highcharts_rails:install
and then
rake db:migrate

in console, I get this:

>> HighChart
NameError: uninitialized constant HighChart
from
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:443:in
`load_missing_constant'
from
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in
`const_missing'
from
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:92:in
`const_missing'
from (irb):4


--
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: Advice on Search Design

by rubyonrailsin 0 comments
I researched searchlogic prior to posting and unless I am missing
something I don't see how it would get around something like this:

if a,b & c but not d
...
elsif a & b but not c & d
....
elsif a and not b,c & d


I did see something construct a mysql query, based on something like:

query = ""
if a then query << ""
if b then query << ""
if c then query << ""
if d then query << ""

but they also stated this was a bad idea...


Am I missing something within the searchlogic doc?
--
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] undefined method `each' for "":String

by rubyonrailsin 0 comments
On 31 March 2010 19:21, ES <emstolfo@gmail.com> wrote:
> I implemented creating an object within another object according to
> this Railscast:
>
> http://railscasts.com/episodes/74-complex-forms-part-2
>
> but I'm getting this error after I submit.  Any ideas?
>
> undefined method `each' for "":String

I think you may need to show us the code around the error.

Colin

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

Read More…

Re: [Rails] Advice on Search Design

by rubyonrailsin 0 comments
Google for "searchlogic".  It's a rails plugin that makes stuff like this very easy to do.

Jamey


On Wed, Mar 31, 2010 at 2:42 PM, Chris Hickman <lists@ruby-forum.com> wrote:
I've been having problems submitting a question to this forum so sorry
in advance if this is a repeat.

I am not looking for code examples, just a pointer in the right
direction as far as design.  I am trying to do a search based on
information form 4 select boxes.  None of the select boxes are mandatory
so there could be a lot of possible combinations.

search for field one, field one and two, field two and three, etc.

I know an if else statement for all the possible combinations would not
be the right way to go.  Should I use Ferret or Sphinx to do a search
like this or is there a better way.

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.



--
You received 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] module loading issue

by rubyonrailsin 0 comments
Trying to keep things organized I created a directory under app called
modules. In my env file I did what I did for my other directories:

config.load_paths += Dir[ "#{RAILS_ROOT}/app/modules/**" ]

Here is the top of my module:

module Sanitize
module Html
def self.included(base)
base.extend(ClassMethods)
end

I have an initializer that does this:
include HtmlSanitize

When I boot up it says unitilialized constant "HtmlSanitize"

What am I missing?

--
You received 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] related products extension not working

by rubyonrailsin 0 comments
Ryan,
I recently added some extra features that depend on a yet-to-released spree-automatic-coupons extension, and I thought I had related_products setup to work without it (but I didn't). 

I've just pushed a fix to related_products so if you grab the latest version you should be good to go!

Later,

Brian

On 31 March 2010 19:32, McKenzie <ryan@souliss.com> wrote:
Hey everyone,

I've just pulled the latest related_products extension from the
RailsDog repo. I've raked the db, restarted the app and navigated to
the product related tab in the admin menu and I've received this error
about some coupon code?

 Showing vendor/extensions/related_products/app/views/admin/products/
related.html.erb  where line #12 raised:

uninitialized constant
ActionView::Base::CompiledTemplates::AutomaticCouponsExtension

Extracted source (around line #12):

9:   <div id="add-line-item">
10:     <fieldset>
11:       <legend><%= t('add_related_product') %></legend>
12:       <div style="float:left;width:<%=
Spree::Extension.descendants.include?(AutomaticCouponsExtension) ?
"40" : "55" %>%;margin-right:5%;">
13:         <%= label_tag :add_product_name, t("name_or_sku") %>
14:         <%= text_field_tag :add_product_name,  {}, :class =>
'fullwidth title'  %>
15:         <%= hidden_field_tag :add_variant_id %>


Has anyone come across this problem before?

Thanks

Ryan

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

[Rails] Re: Re: Re: Updating records

by rubyonrailsin 0 comments
Colin Law wrote:
> On 30 March 2010 19:20, Stephen None <lists@ruby-forum.com> wrote:
>> � �@book.update_attributes(params[:book])
>>
>> 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

That worked great; I will post the final controller in case anyone else
wants to do it but that is pretty cool. I am not using the key field
because the form is on the index page - not the edit page - which means
the record hasn't actually been selected at that point. The barcode
field is unique but not the key field because I need to be able to store
alphanumeric information as part of the barcode and the id field is an
integer. While not necessarily in the spirit of ruby, doing this allows
me to arbitrarily update any record in the database from anywhere in my
application regardless of any nesting or other model complexities.
Thanks for the help, just a couple more problems and my first real app
will be done!
--
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] Rails3 parameters in routes

by rubyonrailsin 0 comments
In Rails 2 I was able to specify extra parameters within a route, like
this:
map.login "login", :controller => "user_sessions", :action => "new",
:tag_index => true
The tag_index would be available in the controller via
params[:tag_index].

I've searched to find a simular solution within Rails 3, but I'm still
unable to find it. Does anybody know a solution?

HJ
--
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: Intermediate level tutorials

by rubyonrailsin 0 comments
On Mar 31, 1:08 pm, IanJ <ian_johns...@pobox.com> wrote:
> Hi
> I'm hoping somebody can suggest an intermediate level tutorial or
> point me in the right direction.

Well, have a try at http://paperc.de where you can read whole books
online for free. It's a German site, but has a lot of english titles.
Just search for ruby on rails. 'Suchen' means search in German :-)

I don't know their business model but it's really great.

Rajiv

--
You received 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] Overriding existing controller in extension

by rubyonrailsin 0 comments
Hi,

I'm actually in the middle of writing a blog article for this type of thing.

Will send a link out when I've finished it.

~Steph

Arek Flinik wrote:
> Hi,
>
> I'd like to create extension which would override just one method in
> existing controller (in this case, create action in OrdersController).
> After hours of trying i've ran out of ideas on how to do it withous
> copy-pasting existing controller file. Does anyone have an idea on how
> to do it in nice and clean way?
>
> Thanks,
> Arek Flinik
>
>

--
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: New to cacheing

by rubyonrailsin 0 comments
Jeremy Woertink wrote:
> David wrote:
>> Have you added the sweeper to your list of observers in config/
>> environment.rb?
>
> Actually, I had not. I had another sweeper, and my user observer in
> there. I will try that out, and post back what happens :)

fail :(

config.active_record.observers = :user_observer, :listing_sweeper

This is what I should have, right?
--
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: Overriding existing controller in extension

by rubyonrailsin 0 comments
Hi,

thanks for quick response. I've actually managed to do exactly the same thing (calling class_eval from activate method in my extension class -- is it the right place?). I just thought it could be done somehow prettier, but it seems it's not possible to extend controllers like you can do it with routes or i18n files. 

On a side note, it's still possible to use resource_controller's methods to make code cleaner and easier to read, also it doesn't abandon existing hooks (like create.before which is by default in OrdersController). Corresponding code would look as follows:

OrdersController.class_eval do
         create do
            #something
         end
end

Thank you kindly anyway,

Arek

On Wed, Mar 31, 2010 at 8:33 PM, McKenzie <ryan@souliss.com> wrote:
Hi Arek,

You can override a method in your extension by using the following:

OrdersController.class_eval do
         def create
            #insert new action here
         end
end

Hope that helps

Ryan

On Mar 31, 7:02 pm, Arek Flinik <afli...@gmail.com> wrote:
> Hi,
>
> I'd like to create extension which would override just one method in
> existing controller (in this case, create action in OrdersController).
> After hours of trying i've ran out of ideas on how to do it withous
> copy-pasting existing controller file. Does anyone have an idea on how
> to do it in nice and clean way?
>
> Thanks,
> Arek Flinik

--
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: New to cacheing

by rubyonrailsin 0 comments
David wrote:
> Have you added the sweeper to your list of observers in config/
> environment.rb?

Actually, I had not. I had another sweeper, and my user observer in
there. I will try that out, and post back what happens :)
--
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: Firebug Console window presents no Command line (>>>>)

by rubyonrailsin 0 comments
RichardOnRails wrote:
> This topic hasn't garnered any interest, so I'm abandoning my attempts
> to fix the installed version and will re-install. So this thread is
> closed as far as I'm concerned.
>
> On Mar 30, 8:26�pm, RichardOnRails

lol, well not exactly rails related, but my guess is that it was in
multi-line mode. you would see a textarea box to the right. You can type
your console commands into that field the same as the single line.
--
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: New to cacheing

by rubyonrailsin 0 comments
Have you added the sweeper to your list of observers in config/
environment.rb?

On Mar 31, 2:43 pm, Jeremy Woertink <li...@ruby-forum.com> wrote:
> Another odd thing maybe someone can clear up for me.
>
> In my sweepers I currently have:
>
> def expire_cache
>   expire_action root_path
> end
>
> but my cache isn't being expired, so I figured I would put the route in
> manually
>
> def expire_cache
>   expire_action :controller => 'site', :action => 'index'
> end
>
> and I get this error:
>
> ActionController::RoutingError (No route matches
> {:controller=>"admin/site", :action=>"index"}):
>
> Now, obviously I'm updating the model in the admin section, but I'm not
> specifying my controller to be 'admin/site'. I just want to update
> object in the admin section, and update the cache on the front end of
> the site.
> --
> 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] Re: undefined method `each' for "":String

by rubyonrailsin 0 comments
I didn't look at the code but it appears you are trying to iterate over
an empty string.
--
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: unitialized constant

by rubyonrailsin 0 comments
Did you run the rake task after you installed the plugin?

On Mar 31, 1:49 pm, John Merlino <li...@ruby-forum.com> wrote:
> I installed this pluginhttp://github.com/loudpixel/highcharts-rails
> and I put this code in my controller:
>
>   def panels
>     @ui_panels = Highchart.pie({
>     :chart => {
>           :renderTo => "pie-chart-container",
>           :margin => [50, 30, 0, 30]
>         },
>         :credits => {
>           :enabled => true,
>           :href => 'http://marketshare.hitslink.com/browser
> px?qprid=3',
>           :text => 'Data provided by NETMARKETSHARE'
>         },
>         :plotOptions => {
>           :pie => {
>             :dataLabels => {
>               :formatter => pie_label_formatter,
>               :style => {
>                 :textShadow => '#000000 1px 1px 2px'
>               }
>             }
>           }
>         },
>       :series => [
>             {
>                 :type => 'pie',
>                 :data => browser_data
>             }
>         ],
>         :subtitle => {
>           :text => 'January 2010'
>         },
>         :title => {
>           :text => 'Browser Market Share'
>         },
>         :tooltip => {
>           :formatter => pie_tooltip_formatter
>         },
>     })
>
>   end
>
> Yet, I get this error:
> NameError in DashboardController#panels
>
> uninitialized constant DashboardController::Highchart
>
> Any suggestions? thanks.
> --
> 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] Re: New to cacheing

by rubyonrailsin 0 comments
Another odd thing maybe someone can clear up for me.

In my sweepers I currently have:

def expire_cache
expire_action root_path
end

but my cache isn't being expired, so I figured I would put the route in
manually

def expire_cache
expire_action :controller => 'site', :action => 'index'
end

and I get this error:

ActionController::RoutingError (No route matches
{:controller=>"admin/site", :action=>"index"}):


Now, obviously I'm updating the model in the admin section, but I'm not
specifying my controller to be 'admin/site'. I just want to update
object in the admin section, and update the cache on the front end of
the site.
--
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] Advice on Search Design

by rubyonrailsin 0 comments
I've been having problems submitting a question to this forum so sorry
in advance if this is a repeat.

I am not looking for code examples, just a pointer in the right
direction as far as design. I am trying to do a search based on
information form 4 select boxes. None of the select boxes are mandatory
so there could be a lot of possible combinations.

search for field one, field one and two, field two and three, etc.

I know an if else statement for all the possible combinations would not
be the right way to go. Should I use Ferret or Sphinx to do a search
like this or is there a better way.

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…

[spree-user] Re: Overriding existing controller in extension

by rubyonrailsin 0 comments
Hi Arek,

You can override a method in your extension by using the following:

OrdersController.class_eval do
def create
#insert new action here
end
end

Hope that helps

Ryan

On Mar 31, 7:02 pm, Arek Flinik <afli...@gmail.com> wrote:
> Hi,
>
> I'd like to create extension which would override just one method in
> existing controller (in this case, create action in OrdersController).
> After hours of trying i've ran out of ideas on how to do it withous
> copy-pasting existing controller file. Does anyone have an idea on how
> to do it in nice and clean way?
>
> Thanks,
> Arek Flinik

--
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: object with many paperclip photos

by rubyonrailsin 0 comments
It should work but I would recommend using
accepts_nested_attributes_for :image.

Few screencasts:
http://railscasts.com/episodes/196-nested-model-form-part-1
http://railscasts.com/episodes/197-nested-model-form-part-2

Best,
Martin

On Mar 31, 5:22 pm, Jeremy Woertink <li...@ruby-forum.com> wrote:
> ES wrote:
> > 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 %>
>
> I know in Rails 2.3.5 there's an easier way to do this, but I cheated a
> bit an used attribute_fu because of this cool helper method.
>
> <% form_for :analysis, @analysis, :url => analysis_path, :html => {
> :multipart => true } do |analysis_form| %>
> <%= analysis_form.render_associated_form(@analysis.photos, :new => 4) %>
> <%= analysis_form.submit('Submit') %>
>
> Then you just add a partial called _photo.html.erb inside your analysis
> view folder, and throw in
>
> <%= analysis_form.label(:image) %>
> <%= analysis_form.file_field(:image) %>
>
> In your model you would put
>
> class Analysis < ActiveRecord::Base
>   has_many :photos, :attributes => true
> end
>
> Hope that helps.
>
> ~Jeremy
>
> --
> 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…

[spree-user] related products extension not working

by rubyonrailsin 0 comments
Hey everyone,

I've just pulled the latest related_products extension from the
RailsDog repo. I've raked the db, restarted the app and navigated to
the product related tab in the admin menu and I've received this error
about some coupon code?

Showing vendor/extensions/related_products/app/views/admin/products/
related.html.erb where line #12 raised:

uninitialized constant
ActionView::Base::CompiledTemplates::AutomaticCouponsExtension

Extracted source (around line #12):

9: <div id="add-line-item">
10: <fieldset>
11: <legend><%= t('add_related_product') %></legend>
12: <div style="float:left;width:<%=
Spree::Extension.descendants.include?(AutomaticCouponsExtension) ?
"40" : "55" %>%;margin-right:5%;">
13: <%= label_tag :add_product_name, t("name_or_sku") %>
14: <%= text_field_tag :add_product_name, {}, :class =>
'fullwidth title' %>
15: <%= hidden_field_tag :add_variant_id %>


Has anyone come across this problem before?

Thanks

Ryan

--
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] undefined method `each' for "":String

by rubyonrailsin 0 comments
I implemented creating an object within another object according to
this Railscast:

http://railscasts.com/episodes/74-complex-forms-part-2

but I'm getting this error after I submit. Any ideas?

undefined method `each' for "":String

--
You received 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: unitialized constant

by rubyonrailsin 0 comments
> uninitialized constant DashboardController::Highchart
>
> Any suggestions? thanks.

Are you able to go into the console and just type Highchart ? See if
it's actually getting loaded into your app. If so, have you tried using
the scope operator :: in front of it?

~Jeremy
--
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] additional fees depending on the payment method

by rubyonrailsin 0 comments
Howdie,

i have already integrated a payment method for bank transfer into our
project (without ActiveMerchant). Now i would like to add another
payment method: cash on delivery, the problem is if a customer chooses
this payment method i need to add some additional fees to the order. I
realize that i could solve this very easy by adding cash on delivery
as a shipping method with a calculator but in my eyes this is a
payment method not a shipping method.

So my question is: What would be the best way to implement additional
fees depending on the payment method?

Thank you very much,

Sebastian

PS.: I really like Spree, keep up the good work ;)

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

Read More…

[spree-user] Overriding existing controller in extension

by rubyonrailsin 0 comments
Hi,

I'd like to create extension which would override just one method in
existing controller (in this case, create action in OrdersController).
After hours of trying i've ran out of ideas on how to do it withous
copy-pasting existing controller file. Does anyone have an idea on how
to do it in nice and clean way?

Thanks,
Arek Flinik

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

Read More…

[spree-user] newsletter extension

by rubyonrailsin 0 comments
Hello,
Does anyone know if there is an extension available to handle
newsletter signups during the checkout process?

Thanks,
Les

--
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] [ANN] PageFactory extension

by rubyonrailsin 0 comments
This is simple and addictive, I'm loving it.

Glad you like it!

if we don't have any PageFactories defined is it necessary to pop up the dialog box?

Nope. I'll fix this before it goes up on the extension registry. 


On Mar 31, 2010, at 1:37 PM, [Square Talent] Dirk Kelly wrote:

This is wonderful Josh :)

I just had a quick play around and this seems to solve every problem I've had with special content pages. This is simple and addictive, I'm loving it.

Just a thought, if we don't have any PageFactories defined is it necessary to pop up the dialog box?

Thanks,
Dirk

On Thu, Apr 1, 2010 at 12:42 AM, Josh French <josh@digitalpulp.com> wrote:
New extension on the loose: PageFactory. This is another take on content types/page templates (defining structure for your pages.)

There are a few existing extensions which have tackled this, including a few in-house implementations here at Digital Pulp. But all of these have at least one of the following limitations:

* Content types are stored in the database. I have to dump content types to YAML to keep them in source control.
* Content types are just lists of parts. I want real objects that I can inherit and extend.
* The implementation limits my flexibility. I want to set up new pages easily, not restrict what I can do with them later.

So PageFactory takes a new approach: it's a small DSL for easily and intelligently defining content types. Each content type is a plain old Ruby class that you can keep in app/models.

Once your pages are created, PageFactory doesn't care what you do with your content. There's a set of rake tasks for keeping your pages in sync with their factory definitions, but it's completely up to you how to manage your pages and parts.

PageFactory only works on edge. There are some internals I'd like to refactor before I put it on the extension registry, but I think the interface is mostly stable. In the meantime I'd love to hear people's thoughts -- PageFactory spawned some lengthy discussion/debate when I demo'd it to my coworkers :)

See the readme for more on the goals and reasoning behind PageFactory. There's a detailed walkthrough in examples.md.

http://github.com/jfrench/radiant-page_factory-extension


- - - - - - - - - - - - - - - - - - - - - - -
Josh French
Senior Engineer, Digital Pulp
josh@digitalpulp.com // 212.679.0676 x291




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


--
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: Using Prawn in Rails 2.3.5

by rubyonrailsin 0 comments
Ok, I had a lot of issues with this too, so I will just put all the
steps I used to get it to work.

#SETUP
#though I'm sure bundler would be better for this
Installed Prawn gem
config.gem 'prawn', :version => '0.6.3'

Installed Prawnto plugin
./script/plugin install git://github.com/thorny-sun/prawnto.git


#Routes
map.with_options(:controller => 'admin/reports') do |m|
m.admin_marketing_report 'admin/marketing', :controller =>
'admin/reports', :action => 'marketing'
end

#Controller
class Admin::ReportsController < AdminController
def marketing
respond_to do |format|
format.pdf do
@advertisements = Advertisement.all
end
end
end
end


#VIEW
/admin/reports/marketing.prf.prawn
pdf.text "Marketing Report", :size => 18, :style => :bold

Hopefully this will help you out.

~Jeremy
--
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] unitialized constant

by rubyonrailsin 0 comments
I installed this plugin http://github.com/loudpixel/highcharts-rails
and I put this code in my controller:

def panels
@ui_panels = Highchart.pie({
:chart => {
:renderTo => "pie-chart-container",
:margin => [50, 30, 0, 30]
},
:credits => {
:enabled => true,
:href => 'http://marketshare.hitslink.com/browser
px?qprid=3',
:text => 'Data provided by NETMARKETSHARE'
},
:plotOptions => {
:pie => {
:dataLabels => {
:formatter => pie_label_formatter,
:style => {
:textShadow => '#000000 1px 1px 2px'
}
}
}
},
:series => [
{
:type => 'pie',
:data => browser_data
}
],
:subtitle => {
:text => 'January 2010'
},
:title => {
:text => 'Browser Market Share'
},
:tooltip => {
:formatter => pie_tooltip_formatter
},
})

end

Yet, I get this error:
NameError in DashboardController#panels

uninitialized constant DashboardController::Highchart

Any suggestions? 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] continue save after before_update observer

by rubyonrailsin 0 comments
On Wed, Mar 31, 2010 at 4:21 AM, Joshua Partogi <jpartogi@scrum8.com> wrote:

> This is what I wrote but it caused stack level too deep error:
>
> class FeatureObserver < ActiveRecord::Observer
> def before_update(feature)
>    feature.send(:save)
> end
> end

:save precedes :update, so you've just created an infinite loop :-)

Try creating before_save, after_save, after_update methods in your
observer with some `puts` logging statements, and run in a console,
e.g.
>> feature.send(:update)
>> feature.send(:save)
and see what you get...

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

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

Read More…

[Rails] Re: Ruby in javascript

by rubyonrailsin 0 comments
Hemant Bhargava wrote:
> Hey Champs..
>
> Can we write some ruby code into javascript ?
>
> Can you guys light me?

you can make a main_scripts.js.erb inside one of your views

then you can mix in ruby and JS together. The ruby will be processed
first, and then made into a static js file, then you can include that.
OR, you can do inline JS in your views (it's yucky though :p ). You
could also get crazy and include the Johnson gem and then get some crazy
ruby generating JS on the fly stuff.

Good luck!

~Jeremy
--
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: [Radiant-Dev] [ANN] PageFactory extension

by rubyonrailsin 0 comments
This is wonderful Josh :)

I just had a quick play around and this seems to solve every problem I've had with special content pages. This is simple and addictive, I'm loving it.

Just a thought, if we don't have any PageFactories defined is it necessary to pop up the dialog box?

Thanks,
Dirk

On Thu, Apr 1, 2010 at 12:42 AM, Josh French <josh@digitalpulp.com> wrote:
New extension on the loose: PageFactory. This is another take on content types/page templates (defining structure for your pages.)

There are a few existing extensions which have tackled this, including a few in-house implementations here at Digital Pulp. But all of these have at least one of the following limitations:

* Content types are stored in the database. I have to dump content types to YAML to keep them in source control.
* Content types are just lists of parts. I want real objects that I can inherit and extend.
* The implementation limits my flexibility. I want to set up new pages easily, not restrict what I can do with them later.

So PageFactory takes a new approach: it's a small DSL for easily and intelligently defining content types. Each content type is a plain old Ruby class that you can keep in app/models.

Once your pages are created, PageFactory doesn't care what you do with your content. There's a set of rake tasks for keeping your pages in sync with their factory definitions, but it's completely up to you how to manage your pages and parts.

PageFactory only works on edge. There are some internals I'd like to refactor before I put it on the extension registry, but I think the interface is mostly stable. In the meantime I'd love to hear people's thoughts -- PageFactory spawned some lengthy discussion/debate when I demo'd it to my coworkers :)

See the readme for more on the goals and reasoning behind PageFactory. There's a detailed walkthrough in examples.md.

http://github.com/jfrench/radiant-page_factory-extension


- - - - - - - - - - - - - - - - - - - - - - -
Josh French
Senior Engineer, Digital Pulp
josh@digitalpulp.com // 212.679.0676 x291




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

--
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: undefined method error

by rubyonrailsin 0 comments
Gautam wrote:
> Thanks for your kind reply.
> Here is the code of my routes.rb file
> Please suggest corrections, if any...
>
> map.resources :notices
> map.resources :users, :has_many => :notices
> map.resource :session
>
> map.connect ':controller/:action/:id'
> map.connect ':controller/:action/:id.:format'
> map.connect '/notices/:id/:abc', :controller => "notices", :action
> => "abc"
>
> map.root :controller=> 'welcome'
> map.signup '/signup', :controller => 'users', :action => 'new'
> map.login '/login', :controller => 'sessions', :action => 'new'
> map.logout '/logout', :controller => 'sessions', :action =>
> 'destroy'
> map.create '/create', :controller => 'notices', :action => 'new'

try this out. Change

map.connect '/notices/:id/:abc', :controller => "notices", :action
> => "abc"

to

map.abc_notice '/notices/:id/:abc', :controller => "notices", :action
> => "abc"


Then when you call abc_notice_path(4, 'alphabet')

Maybe that will help out.
--
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] any body can help me ?? why is this happen??

by rubyonrailsin 0 comments
Thank you all
I found why that happen...

On Wed, Mar 31, 2010 at 11:39 PM, Jeffrey L. Taylor <ror@abluz.dyndns.org> wrote:
Quoting anton effendi <wuyouduan@gmail.com>:
> Hii All
>
> I use ruby 1.8.7
> I run irb and type:
>
> a = (0.29 * 100).to_i
>
> the result is 28

Here's why:

irb(main):008:0> '%0.16f' % (0.29 * 100)
=> "28.9999999999999964"

Most decimal fractions cannot be represented exactly in binary.  If you need
them to behave in certain ways, e.g. using real numbers to represent US
dollars and cents, take care and learn to use the following functions as
needed.

irb(main):002:0> (0.29 * 100).to_i
=> 28
irb(main):003:0> (0.29 * 100).round
=> 29
irb(main):004:0> (0.29 * 100).floor
=> 28
irb(main):005:0> (0.29 * 100).ceil
=> 29
irb(main):009:0> (-0.29 * 100)
=> -29.0
irb(main):010:0> (-0.29 * 100).to_i
=> -28
irb(main):011:0> (-0.29 * 100).floor
=> -29
irb(main):012:0> (-0.29 * 100).round
=> -29
irb(main):013:0> (-0.29 * 100).ceil
=> -28


IIRC, .to_i rounds towards zero, .floor rounds down, .ceil rounds up, and
.round adds 1/2 and rounds towards zero.

HTH,
 Jeffrey

P.S. if you are in the financial field, the SEC has rules on how to do
arithmetic in US dollars and cents.

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




--

Senior Rails Developer
Anton Effendi - Wu You Duan

--
You received 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] New to cacheing

by rubyonrailsin 0 comments
Ok, So, I'm a bad developer and have never used any sort of cacheing
before. I decided it's time I step up and I threw in some memcached
magic. I'm still pretty new to all this, so I'm confused on how some
things work. I've watched the railscast on cacheing, and gone through
many tutorials.

So, the problem I'm having is that I have this page being cached, and
it's not updating the page when I do any sort of CRUD action on the
model primarily used on this page.

Here is what I have

class SiteController < ApplicationController
caches_action :index

def index
#this in my home page
end
en

class ListingsController < SiteController
#This is the page being cached
def index
@listings = Listing.all
end
end

class ListingSweeper < ActionController::Caching::Sweeper
observe Listing

def after_save(listing)
expire_cache(listing)
end

def after_update(listing)
expire_cache(listing)
end

def after_destroy(listing)
expire_cache(listing)
end

def expire_cache(listing)
expire_action root_path
expire_action listings_path
end

end


When I create a new Listing, or update or destroy an existing one, it
should clear the cache of the ListingsController#index, right?

When I go the the page, and refresh over and over, this is what pops up
in my production.log

Processing ListingsController#index (for 12.34.567.58 at 2010-03-31
17:13:29) [GET]
Filter chain halted as
[#<ActionController::Filters::AroundFilter:0x2aaaae2804c8
@options={:if=>nil, :unless=>nil, :only=>#<Set: {"contact", "index"}>},
@method=#<Proc:0x00002aaaac2a3ec0@/var/rails/app/releases/20100331171209/vendor/rails/actionpack/lib/action_controller/caching/actions.rb:64>,
@kind=:filter, @identifier=nil>] did_not_yield.
Completed in 2ms (View: 0, DB: 0) | 200 OK
[http://245.254.135.24/listings]


Anyone have a good link for a tutorial I can get, or maybe an idea or
what I might be missing?

Any help is much appreciated!

Thanks,
~Jeremy
--
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: Localize doesn't work

by rubyonrailsin 0 comments
No, unfortunately not. Anyone else an idea?
--
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: Stop using Foo Bar!

by rubyonrailsin 0 comments
On Wed, Mar 31, 2010 at 10:02 AM, Kyle Drake <kyledrake@gmail.com>
made a major leap towards irrelevance, writing:

> It's not April 1st yet, fix your clock.

Erm, actually it *is* April 1st in some time zones :-)

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

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

Read More…

[Rails] Re: undefined local variable or method `request'—in test

by rubyonrailsin 0 comments
Any thoughts on this one guys?

Thanks

On Mar 30, 5:03 pm, elliottg <x...@simplecircle.net> wrote:
> 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…

[spree-user] Re: Upgrade to beta

by rubyonrailsin 0 comments
For people that stumbled on this after getting the same error message:

The problem is you still have your spree installation somewhere
(probably in the app itself - check out vendors/spree), and it's
conflicting with the new 0.10.x version. Check the file
extension_loader.rb - new Spree has a method
"stylesheet_source_paths", while the old Spree doesn't. Remove old
Spree from everywhere and make sure your app only looks at new Spree.

On Mar 11, 4:12 pm, Rodrigo Lombardo <rod...@gmail.com> wrote:
> Alright, I will do that. But I have another question. The only way to
> do an update is using the spree gem? Can I update pulling down commits
> from github? Whats the better solution?
>
> Thanks again,
>
> Rodrigo Nicola
> rodrigo.lomba...@nicomax.com.br
> NicoMAX WebSolutions
> Phone:+55 11 4063 9081
> Cell:+55 19 8218 8941
>
> On Thu, Mar 11, 2010 at 3:37 PM, Sean Schofield <s...@railsdog.com> wrote:
> > I suggest you try updating one version at a time.  Over time we'll
> > have better support for jumping versions but its not recommended.
> > Make sure to run the migrations each time of course.
>
> > Sean Schofield
>
> > -------------------------------------------
> > Rails Dog LLC
> > 2 Wisconsin Circle, Suite 700
> > Chevy Chase, MD 20815
> > voice:(301)560-2000
> > -------------------------------------------
>
> > On Thu, Mar 11, 2010 at 1:15 PM, Rodrigo Lombardo <rod...@gmail.com> wrote:
> >> Hi,
>
> >> I'm having troubles trying to upgrade my Spree application from
> >> version 0.8 to 0.10.0 beta. I'm using rubygems 1.3.6 with the newest
> >> Spree gem(Spree 0.10.0.beta) and running  ruby1.8.7(2009-06-12
> >> patchlevel 174) [i486-linux]
>
> >> I ran spree --update, rake gems:install and rake db:migrate. I removed
> >> some old gems like compass, deleting the initializer too. So far so
> >> good but I got an error when I tried to run script/server -e
> >> development
>
> >> this is the error:
>
> >> => Rails 2.3.5 application starting onhttp://0.0.0.0:3000
> >> ./script/../config/../lib/simpleton.rb:19:in `method_missing':
> >> undefined method `stylesheet_source_paths' for
> >> Spree::ExtensionLoader:Class (NoMethodError)
> >>        from /usr/lib/ruby/gems/1.8/gems/spree-0.10.0.beta/lib/spree/theme_support/more_patches.rb:117
> >>        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
> >> `gem_original_require'
> >>        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
> >> `polyglot_original_require'
> >>        from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.0/lib/polyglot.rb:65:in `require'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
> >> `require'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in
> >> `new_constants_in'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
> >> `require'
> >>        from /usr/lib/ruby/gems/1.8/gems/spree-0.10.0.beta/lib/spree/theme_support.rb:2
> >>        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in
> >> `gem_original_require'
> >>        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in
> >> `polyglot_original_require'
> >>        from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.0/lib/polyglot.rb:65:in `require'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
> >> `require'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in
> >> `new_constants_in'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
> >> `require'
> >>        from /home/rodrigo/herosmoda/config/initializers/spree.rb:53
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in
> >> `load_without_new_constant_marking'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in
> >> `load'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in
> >> `new_constants_in'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in
> >> `load'
> >>        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:622:in
> >> `load_application_initializers'
> >>        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in `each'
> >>        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in
> >> `load_application_initializers'
> >>        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:176:in
> >> `process'
> >>        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
> >>        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
> >>        from ./script/../config/../lib/spree/initializer.rb:86:in `run'
> >>        from /home/rodrigo/herosmoda/config/environment.rb:13
> >>        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
> >> `gem_original_require'
> >>        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
> >> `require'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in
> >> `new_constants_in'
> >>        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
> >> `require'
> >>        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
> >>        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
> >> `gem_original_require'
> >>        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
> >>        from script/server:3
>
> >> Anyone with this problem?
>
> >> Thanks,
>
> >> Rodrigo Nicola
> >> rodrigo.lomba...@nicomax.com.br
> >> NicoMAX WebSolutions
> >> Phone:+55 11 4063 9081
> >> Cell:+55 19 8218 8941
>
> >> --
> >> 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 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…

[Rails] Re: Re: Problem saving object

by rubyonrailsin 0 comments
Colin Law wrote:
> On 31 March 2010 16:33, Jeremy Woertink <lists@ruby-forum.com> wrote:
>>>>>> l.name = "test"
>>>>> a <=> b
>>>>> 5 <=> 4
>>
>> Yeah, that much I'm certain of. The only thing I don't know is maybe if
>> cache-money does something with that when trying to save an object and
>> throwing it into cache.
>>
>> This all works perfectly fine on my local machine, just not on the
>> production server. So I figure it's some gem that only does certain
>> things in production. I'm using Geokit too, so if anyone knows of any
>> issue with either of these gems that might cause something like this,
>> please let me know.
>
> Can't you see from the trace where it is failing?
>
> Colin

Yeah, I looked through the trace, and it was nothing but all these
cache-money calls. I figured it out though, had nothing to do with
cache-money. It was Geokit. I just started commenting out lines until it
worked, and taking out acts_as_mappable seemed to have fixed it >.< I'm
sure this is a "hack" solution because it doesn't make sense at all.
Thanks for the help guys!

~Jeremy
--
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: Stop using Foo Bar!

by rubyonrailsin 0 comments
It's not April 1st yet, fix your clock.

-Kyle

--
You received 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