Re: [Rails] Re: best ui toolkit?

2011-01-12 Thread Mauro
On 13 January 2011 02:39, Marnen Laibow-Koser  wrote:

> Have Rails put the data in the DOM.  Have the JS read it.  Done.

have you some examples?

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



[Rails] permissions and authorization

2011-01-12 Thread Mike C
In my app I have 3 different models in a linear fashion:

M1, M2, and M3. M1 has many M2 which has many M3.

M1 has 2 properties: private and completed. If it's private then only
the person who created M1 can do anything with it (all the rest
actions), and if it's completed then more M2 and M3 cannot be added.

For M2, only the M1 creator and the M2 creater (the M2 creator is most
likely a different person) can do anything with it (rest actions), and
the same goes for M3 except the people who can do anything with M3 are
the owners of M1, M2, and M3.

It seems these permissions are really complex and I'm not sure how I
should go about this. Before I just had protected methods in each of
the controllers of these models, but theres a lot of repeated code and
its just not pretty to look at. Should I abstract some of this into
the ApplicationController, or create a module/helper for this?

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



[Rails] ActiveRecord::StatementInvalid

2011-01-12 Thread Tom Mac
Hi
   I am using rails2.2.2 with mysql5.1. I have a text field 'EmailBody'.
And when I try to store data more than 65536  (Say for example 65550) in
linux it works properly by truncating it to 65536 characters and save
successfully to table.  But when I test this same application on a
windows machine I get the error ActiveRecord::StatementInvalid. I am
attaching the error I am getting on a windows machine. Is it a adapter
prblem. Please help

Thanks in advance

Attachments:
http://www.ruby-forum.com/attachment/5733/inbox.htm


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



[Rails] Re: WickedPDF vs PDFKit vs. Prawn, etc.

2011-01-12 Thread Amar Daxini
Marnen Laibow-Koser wrote in post #974456:
> Garrett Lancaster wrote in post #974445:
>> Thoughts on using WickedPDF vs PDFKit vs. Prawn or others for developing
>> forms with dynamic content?
>
You can use Flying Saucer Library.Which convert XHTML to PDF.
It also support css 2.1.So there is less change in your view.
You can install plugin 
http://github.com/amardaxini/acts_as_flying_saucer.
You can search more on http://railstech.com/tag/act_as_flying_saucer/

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



[Rails] Re: RoR Tutorial : clear password field

2011-01-12 Thread Dan L.
Marcel Faas wrote in post #944158:
> Learning Rails following the Rails Tutorial book I have the following
> question.
> In chapter 8 at the Exercises part they talk about clearing the
> password field.
> I tried several things to do this, but till now didn't find the
> solution.
> Anyone has a tip how to do this?
> Thanks in advance

The question comes from http://railstutorial.org/chapters/sign-up#sec:signup_exercises";>railstutorial.org.

The exercise in question:
Oftentimes signup forms will clear the password field for failed 
submissions, as shown in Figure 8.12. Modify the Users controller create 
action to replicate this behavior. Hint: Reset @user.password.

The solution: SPOLIERS!
In your user controller you defined 'create'.  If the save is 
successful(if @user.save) nothing needs to be changed.  If the save is 
unsuccessful(the 'else' condition in your code) we render new again with 
error messages.  You must reset @user.password before rendering the 
'new' page by setting it to nil.


  def create
@user = User.new(params[:user])
if @user.save
  flash[:success] = "Welcome to the Sample App!"
  redirect_to @user
else
  @title = "Sign up"
  @user.password = nil
  @user.password_confirmation = nil
  render 'new'
end
  end

Note: this code will not work if its placed after render 'new'.  It also 
will not work if you place it in 'def new' because you aren't calling 
that method, which is also why you have to set @title = "Sign up" again.

Hope that helps,
Dan Luchi
d...@danluchi.com

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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread Anju P s
David White wrote in post #974274:
> Could you post your projects controller? Might be able to see if there's
> something wrong in there.
>
> David


Here is my projects_controller.rb.

class ProjectsController < ApplicationController
  menu_item :overview
  menu_item :activity, :only => :activity
  menu_item :roadmap, :only => [:roadmap]
  menu_item :files, :only => [:list_files, :add_file]
  menu_item :settings, :only => :settings

  before_filter :find_project, :except => [ :index, :list, :add, :copy, 
:activity,:draganddropsort ]
  before_filter :find_optional_project, :only => :activity
  before_filter :authorize, :except => [ :index, :list, :add, :copy, 
:archive, :unarchive, :destroy, :activity,:draganddropsort ]
  before_filter :authorize_global, :only => :add
  before_filter :require_admin, :only => [ :copy, :archive, :unarchive, 
:destroy ]
  accept_key_auth :activity, :index

  after_filter :only => [:add, :edit, :archive, :unarchive, :destroy] do 
|controller|
if controller.request.post?
  controller.send :expire_action, :controller => 'welcome', :action 
=> 'robots.txt'
end
  end

  helper :sort
  include SortHelper
  helper :custom_fields
  include CustomFieldsHelper
  helper :issues
  helper :queries
  include QueriesHelper
  helper :repositories
  include RepositoriesHelper
  include ProjectsHelper

  # Lists visible projects
  def index

  end

  # Add a new project
  def add
   
  end

 ...



  def draganddropsort
  #@issue = Issue.find_by_id(params["1479"])
  @issues = Issue.find(params[:issue_list])
  @issues.each do |issue|
  #issue.custom_field_values.value = params['issue-list' 
].index(issue.id.to_s) + 1
issue.subject = "test"
issue.save
  end
  render :nothing => true
  end

 end



Thanks
Anju

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



[Rails] injecting minitest/spec into IntegrationTest?

2011-01-12 Thread Suraj Kurapati
Hello,

I want to use the minitest/spec DSL inside an
ActionDispatch::IntegrationTest but I'm getting no-method errors:

#-
# cat test/integration/wacky_integration_test.rb
#-
require 'test_helper'
require 'minitest/spec'

class WackyIntegrationTest < ActionDispatch::IntegrationTest
  before do
p :before
  end

  describe 'test' do
it 'should be wacky' do
  (2 + 2).must_equal 4
end
  end
end

#-
# ruby -Ilib:test test/integration/wacky_integration_test.rb
#-
test/integration/wacky_integration_test.rb:5:in
`': undefined method `before' for
WackyIntegrationTest:Class (NoMethodError)
  from test/integration/wacky_integration_test.rb:4:in `'


Any ideas on how to inject the minitest/spec DSL into IntegrationTest?

Thanks for your consideration.

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



[Rails] Re: auto save option in assoications

2011-01-12 Thread Prasad B.
Kaleem Ullah wrote in post #974292:
> Here is the good guide.
> http://edgeapi.rubyonrails.org/classes/ActiveRecord/AutosaveAssociation.html

i am new to ruby on rails ,thank you very much sir

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



Re: [Rails] Re: PostgreSQL aggregate function inconsistent (returns strings)

2011-01-12 Thread Philip Hallstrom


On Jan 12, 2011, at 5:09 PM, IAmNan wrote:

> You're not too late and I appreciate your feedback.
> 
> But it gives the same stringified results. So, I don't think AR is
> tries to interpret the types at all. It always thought it did in order
> to provide a consistent interface. The fact that count works as
> expected confuses me though. I'd think count and sum would behave
> identically (except for the result, obviously).

Well, count() is just counting rows... it has to be an integer.  SUM() might be 
counting other things (decimals say) so maybe AR can't decide.

Still, it should be able to do it..

What's the SQL being generated?

Any difference if instead of joins() you includes() ?


> On Jan 12, 8:42 pm, Philip Hallstrom  wrote:
>> On Jan 12, 2011, at 4:23 PM, IAmNan wrote:
>> 
>>> Okay, I understand what you are saying about :quantity not being on
>>> the Order table. (Interesting, though... I just tried replacing "sum"
>>> with "count" and guess what: numeric values come back.)
>> 
>>> So two possible solutions: use ruby (in the model) to "fix" the hash
>>> after the query, or use hardcoded SQL that explicitly declares the
>>> return type instead of letting AR construct the SQL. Sounds about
>>> right?
>> 
>> I'm coming into this way late, but what happens if you...
>> 
>> sum('sales.quantity')
>> 
>> Would that give AR enough of a hint to figure out what table/type to cast it 
>> to?
>> 
>> Can you post the actual SQL being generated?  I didn't see it in the 
>> archives...
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> On Jan 12, 7:46 pm, Frederick Cheung 
>>> wrote:
 On Jan 12, 7:22 pm, IAmNan  wrote:> As always, Fred, 
 thanks for your reply.
>> 
> The example you give works until you include a join, then you get
> strings again.
>> 
> Order.joins(:sales).group(:product_id).sum(:quantity)
>> 
 Quantity isn't on the model actually being queried so this doesn't
 surprise me. It does suck though. It looks like the sqlite3 driver is
 just smarter about asking the db for the types of the columns (I think
 that with sqlite3 you sort of don't have a choice the way the api is
 written, whereas with mysql you get all the columns as strings "for
 free". I could be wrong though. I don't know what the postgres api is
 like at all).
>> 
 Fred
>> 
> That returns strings again. I don't think I did anything AR shouldn't
> be aware of. BTW, the product_id is returned as a string too. I've
> verified that SQLite3 returns numbers for both. This really seems
> broken to me.
>> 
> Order has_many :sales
> Sale belongs_to :order
> Order has a ordered_at datetime and the seller_id, Sale has the
> product_id and quantity. This is why I need the join. (Oh, and Sale is
> actually LineItem/line_item, although I doubt that makes a
> difference.)
>> 
> d.
>> 
> On Jan 11, 1:14 pm, Frederick Cheung 
> wrote:
>> 
>> On Jan 11, 4:47 pm, IAmNan  wrote:
>> 
>>> I wrote this question on RoRTalk back in August but haven't heard back
>>> yet:http://tinyurl.com/4ohxdnf. So I think I must've been unclear.
>> 
>>> Assume you have a Sale model with just a product Id and a quantity
>>> sold. You want to see a total number of sales for each product.
>> 
>>> Product.group(:product_id).select("product_id, sum(quantity) as
>>> total_quantity")
>> 
>>> Let's collect just the totals to see what they look like in irb:
>>> Product.group(:product_id).select("product_id, sum(quantity) as
>>> total_quantity").map(&:total_quantity)
>> 
>>> In SQLite (and MySQL I think) I get the following:
>>> => [293.00, 4.00, 76.00, 9.00, 370.25, 71.00]
>> 
>>> BUT! PostgreSQL returns this:
>>> => ["293.00", "4.00", "76.00", "9.00", "370.25", "71.00"]
>> 
>>> Strings! Why strings!? Am I doing something wrong? Why is this
>>> happening, how do I fix it, and why doesn't ActiveRecord protect poor
>>> little me from the mean world of db inconsistencies? ;)
>> 
>> In general AR doesn't know the type of non column expressions.
>> If you did something like Product..group(:product_id).sum(:quantity)
>> then AR knows you're doing a sum, and it knows that the sum of
>> decimals should be decimals so it would cast what it got back from the
>> db to the appropriate type
>> 
>> Fred
>> 
>>> Thank in advance.
>>> PS Quantity is a decimal in the schema.
>> 
>>> --
>>> 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-t...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> rubyonrails-talk+unsubscr...@googlegroups.com.
>>> For more options, visit this group 
>>> athttp://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

[Rails] Re: PostgreSQL aggregate function inconsistent (returns strings)

2011-01-12 Thread IAmNan
One other thing... the SQL generated by AR returns the correct column
types if pasted in the pgsql shell or in pgAdmin.

On Jan 12, 9:09 pm, IAmNan  wrote:
> You're not too late and I appreciate your feedback.
>
> But it gives the same stringified results. So, I don't think AR is
> tries to interpret the types at all. It always thought it did in order
> to provide a consistent interface. The fact that count works as
> expected confuses me though. I'd think count and sum would behave
> identically (except for the result, obviously).
>
> On Jan 12, 8:42 pm, Philip Hallstrom  wrote:
>
>
>
>
>
>
>
> > On Jan 12, 2011, at 4:23 PM, IAmNan wrote:
>
> > > Okay, I understand what you are saying about :quantity not being on
> > > the Order table. (Interesting, though... I just tried replacing "sum"
> > > with "count" and guess what: numeric values come back.)
>
> > > So two possible solutions: use ruby (in the model) to "fix" the hash
> > > after the query, or use hardcoded SQL that explicitly declares the
> > > return type instead of letting AR construct the SQL. Sounds about
> > > right?
>
> > I'm coming into this way late, but what happens if you...
>
> > sum('sales.quantity')
>
> > Would that give AR enough of a hint to figure out what table/type to cast 
> > it to?
>
> > Can you post the actual SQL being generated?  I didn't see it in the 
> > archives...
>
> > > On Jan 12, 7:46 pm, Frederick Cheung 
> > > wrote:
> > >> On Jan 12, 7:22 pm, IAmNan  wrote:> As always, Fred, 
> > >> thanks for your reply.
>
> > >>> The example you give works until you include a join, then you get
> > >>> strings again.
>
> > >>> Order.joins(:sales).group(:product_id).sum(:quantity)
>
> > >> Quantity isn't on the model actually being queried so this doesn't
> > >> surprise me. It does suck though. It looks like the sqlite3 driver is
> > >> just smarter about asking the db for the types of the columns (I think
> > >> that with sqlite3 you sort of don't have a choice the way the api is
> > >> written, whereas with mysql you get all the columns as strings "for
> > >> free". I could be wrong though. I don't know what the postgres api is
> > >> like at all).
>
> > >> Fred
>
> > >>> That returns strings again. I don't think I did anything AR shouldn't
> > >>> be aware of. BTW, the product_id is returned as a string too. I've
> > >>> verified that SQLite3 returns numbers for both. This really seems
> > >>> broken to me.
>
> > >>> Order has_many :sales
> > >>> Sale belongs_to :order
> > >>> Order has a ordered_at datetime and the seller_id, Sale has the
> > >>> product_id and quantity. This is why I need the join. (Oh, and Sale is
> > >>> actually LineItem/line_item, although I doubt that makes a
> > >>> difference.)
>
> > >>> d.
>
> > >>> On Jan 11, 1:14 pm, Frederick Cheung 
> > >>> wrote:
>
> >  On Jan 11, 4:47 pm, IAmNan  wrote:
>
> > > I wrote this question on RoRTalk back in August but haven't heard back
> > > yet:http://tinyurl.com/4ohxdnf. So I think I must've been unclear.
>
> > > Assume you have a Sale model with just a product Id and a quantity
> > > sold. You want to see a total number of sales for each product.
>
> > > Product.group(:product_id).select("product_id, sum(quantity) as
> > > total_quantity")
>
> > > Let's collect just the totals to see what they look like in irb:
> > > Product.group(:product_id).select("product_id, sum(quantity) as
> > > total_quantity").map(&:total_quantity)
>
> > > In SQLite (and MySQL I think) I get the following:
> > > => [293.00, 4.00, 76.00, 9.00, 370.25, 71.00]
>
> > > BUT! PostgreSQL returns this:
> > > => ["293.00", "4.00", "76.00", "9.00", "370.25", "71.00"]
>
> > > Strings! Why strings!? Am I doing something wrong? Why is this
> > > happening, how do I fix it, and why doesn't ActiveRecord protect poor
> > > little me from the mean world of db inconsistencies? ;)
>
> >  In general AR doesn't know the type of non column expressions.
> >  If you did something like Product..group(:product_id).sum(:quantity)
> >  then AR knows you're doing a sum, and it knows that the sum of
> >  decimals should be decimals so it would cast what it got back from the
> >  db to the appropriate type
>
> >  Fred
>
> > > Thank in advance.
> > > PS Quantity is a decimal in the schema.
>
> > > --
> > > 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-t...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://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-t...@googlegroups.com.
To unsubscribe from this group, send emai

[Rails] Re: best ui toolkit?

2011-01-12 Thread Marnen Laibow-Koser
Msan Msan wrote in post #974414:
> On 10 January 2011 18:40, Peter De Berdt 
> wrote:
>
>>
>> It should be clear by now that gems/plugins for javascript generation are to
>> be avoided. Not only will it generate ugly inline code in most cases, but
>> you also lose a lot of control. If you want to use Javascript, then write
>> Javascript, don't let some ruby gem write the code for you.
>
> I'm trying using the pure jquery jqgrid.
> I've write the javascript code to display a datagrid, I get the code
> from jqgrid demos http://trirand.com/blog/jqgrid/jqgrid.html#.
> Now I have great problem to take data from a rails model.
> I don't know how and there isn't examples.

Have Rails put the data in the DOM.  Have the JS read it.  Done.

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

Sent from my iPhone

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

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



[Rails] Re: PostgreSQL aggregate function inconsistent (returns strings)

2011-01-12 Thread IAmNan
You're not too late and I appreciate your feedback.

But it gives the same stringified results. So, I don't think AR is
tries to interpret the types at all. It always thought it did in order
to provide a consistent interface. The fact that count works as
expected confuses me though. I'd think count and sum would behave
identically (except for the result, obviously).

On Jan 12, 8:42 pm, Philip Hallstrom  wrote:
> On Jan 12, 2011, at 4:23 PM, IAmNan wrote:
>
> > Okay, I understand what you are saying about :quantity not being on
> > the Order table. (Interesting, though... I just tried replacing "sum"
> > with "count" and guess what: numeric values come back.)
>
> > So two possible solutions: use ruby (in the model) to "fix" the hash
> > after the query, or use hardcoded SQL that explicitly declares the
> > return type instead of letting AR construct the SQL. Sounds about
> > right?
>
> I'm coming into this way late, but what happens if you...
>
> sum('sales.quantity')
>
> Would that give AR enough of a hint to figure out what table/type to cast it 
> to?
>
> Can you post the actual SQL being generated?  I didn't see it in the 
> archives...
>
>
>
>
>
>
>
> > On Jan 12, 7:46 pm, Frederick Cheung 
> > wrote:
> >> On Jan 12, 7:22 pm, IAmNan  wrote:> As always, Fred, 
> >> thanks for your reply.
>
> >>> The example you give works until you include a join, then you get
> >>> strings again.
>
> >>> Order.joins(:sales).group(:product_id).sum(:quantity)
>
> >> Quantity isn't on the model actually being queried so this doesn't
> >> surprise me. It does suck though. It looks like the sqlite3 driver is
> >> just smarter about asking the db for the types of the columns (I think
> >> that with sqlite3 you sort of don't have a choice the way the api is
> >> written, whereas with mysql you get all the columns as strings "for
> >> free". I could be wrong though. I don't know what the postgres api is
> >> like at all).
>
> >> Fred
>
> >>> That returns strings again. I don't think I did anything AR shouldn't
> >>> be aware of. BTW, the product_id is returned as a string too. I've
> >>> verified that SQLite3 returns numbers for both. This really seems
> >>> broken to me.
>
> >>> Order has_many :sales
> >>> Sale belongs_to :order
> >>> Order has a ordered_at datetime and the seller_id, Sale has the
> >>> product_id and quantity. This is why I need the join. (Oh, and Sale is
> >>> actually LineItem/line_item, although I doubt that makes a
> >>> difference.)
>
> >>> d.
>
> >>> On Jan 11, 1:14 pm, Frederick Cheung 
> >>> wrote:
>
>  On Jan 11, 4:47 pm, IAmNan  wrote:
>
> > I wrote this question on RoRTalk back in August but haven't heard back
> > yet:http://tinyurl.com/4ohxdnf. So I think I must've been unclear.
>
> > Assume you have a Sale model with just a product Id and a quantity
> > sold. You want to see a total number of sales for each product.
>
> > Product.group(:product_id).select("product_id, sum(quantity) as
> > total_quantity")
>
> > Let's collect just the totals to see what they look like in irb:
> > Product.group(:product_id).select("product_id, sum(quantity) as
> > total_quantity").map(&:total_quantity)
>
> > In SQLite (and MySQL I think) I get the following:
> > => [293.00, 4.00, 76.00, 9.00, 370.25, 71.00]
>
> > BUT! PostgreSQL returns this:
> > => ["293.00", "4.00", "76.00", "9.00", "370.25", "71.00"]
>
> > Strings! Why strings!? Am I doing something wrong? Why is this
> > happening, how do I fix it, and why doesn't ActiveRecord protect poor
> > little me from the mean world of db inconsistencies? ;)
>
>  In general AR doesn't know the type of non column expressions.
>  If you did something like Product..group(:product_id).sum(:quantity)
>  then AR knows you're doing a sum, and it knows that the sum of
>  decimals should be decimals so it would cast what it got back from the
>  db to the appropriate type
>
>  Fred
>
> > Thank in advance.
> > PS Quantity is a decimal in the schema.
>
> > --
> > 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-t...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Scheduled tasks on rails

2011-01-12 Thread Jeffrey L. Taylor
Quoting Owain :
> >
> > Look at local_request? method in ActionController.
> >
> 
> Jeffrey,
> 
> Certainly another option but I would prefer not to have "network
> config" logic in my application if I can help it.  If you want to
> manage all of the housekeeping jobs from a remote curl or put in load
> balancers you would need to change code.  I prefer to protect
> resources like this in my httpd.conf that defines the server and
> network environment.
> 
Whatever.  Then the question is one for the Apache forums, not Rails.

Jeffrey

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



Re: [Rails] Re: PostgreSQL aggregate function inconsistent (returns strings)

2011-01-12 Thread Philip Hallstrom

On Jan 12, 2011, at 4:23 PM, IAmNan wrote:

> Okay, I understand what you are saying about :quantity not being on
> the Order table. (Interesting, though... I just tried replacing "sum"
> with "count" and guess what: numeric values come back.)
> 
> So two possible solutions: use ruby (in the model) to "fix" the hash
> after the query, or use hardcoded SQL that explicitly declares the
> return type instead of letting AR construct the SQL. Sounds about
> right?

I'm coming into this way late, but what happens if you...

sum('sales.quantity')

Would that give AR enough of a hint to figure out what table/type to cast it to?

Can you post the actual SQL being generated?  I didn't see it in the archives...


> On Jan 12, 7:46 pm, Frederick Cheung 
> wrote:
>> On Jan 12, 7:22 pm, IAmNan  wrote:> As always, Fred, 
>> thanks for your reply.
>> 
>>> The example you give works until you include a join, then you get
>>> strings again.
>> 
>>> Order.joins(:sales).group(:product_id).sum(:quantity)
>> 
>> Quantity isn't on the model actually being queried so this doesn't
>> surprise me. It does suck though. It looks like the sqlite3 driver is
>> just smarter about asking the db for the types of the columns (I think
>> that with sqlite3 you sort of don't have a choice the way the api is
>> written, whereas with mysql you get all the columns as strings "for
>> free". I could be wrong though. I don't know what the postgres api is
>> like at all).
>> 
>> Fred
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> That returns strings again. I don't think I did anything AR shouldn't
>>> be aware of. BTW, the product_id is returned as a string too. I've
>>> verified that SQLite3 returns numbers for both. This really seems
>>> broken to me.
>> 
>>> Order has_many :sales
>>> Sale belongs_to :order
>>> Order has a ordered_at datetime and the seller_id, Sale has the
>>> product_id and quantity. This is why I need the join. (Oh, and Sale is
>>> actually LineItem/line_item, although I doubt that makes a
>>> difference.)
>> 
>>> d.
>> 
>>> On Jan 11, 1:14 pm, Frederick Cheung 
>>> wrote:
>> 
 On Jan 11, 4:47 pm, IAmNan  wrote:
>> 
> I wrote this question on RoRTalk back in August but haven't heard back
> yet:http://tinyurl.com/4ohxdnf. So I think I must've been unclear.
>> 
> Assume you have a Sale model with just a product Id and a quantity
> sold. You want to see a total number of sales for each product.
>> 
> Product.group(:product_id).select("product_id, sum(quantity) as
> total_quantity")
>> 
> Let's collect just the totals to see what they look like in irb:
> Product.group(:product_id).select("product_id, sum(quantity) as
> total_quantity").map(&:total_quantity)
>> 
> In SQLite (and MySQL I think) I get the following:
> => [293.00, 4.00, 76.00, 9.00, 370.25, 71.00]
>> 
> BUT! PostgreSQL returns this:
> => ["293.00", "4.00", "76.00", "9.00", "370.25", "71.00"]
>> 
> Strings! Why strings!? Am I doing something wrong? Why is this
> happening, how do I fix it, and why doesn't ActiveRecord protect poor
> little me from the mean world of db inconsistencies? ;)
>> 
 In general AR doesn't know the type of non column expressions.
 If you did something like Product..group(:product_id).sum(:quantity)
 then AR knows you're doing a sum, and it knows that the sum of
 decimals should be decimals so it would cast what it got back from the
 db to the appropriate type
>> 
 Fred
>> 
> Thank in advance.
> PS Quantity is a decimal in the schema.
> 
> -- 
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: PostgreSQL aggregate function inconsistent (returns strings)

2011-01-12 Thread IAmNan
Okay, I understand what you are saying about :quantity not being on
the Order table. (Interesting, though... I just tried replacing "sum"
with "count" and guess what: numeric values come back.)

So two possible solutions: use ruby (in the model) to "fix" the hash
after the query, or use hardcoded SQL that explicitly declares the
return type instead of letting AR construct the SQL. Sounds about
right?

On Jan 12, 7:46 pm, Frederick Cheung 
wrote:
> On Jan 12, 7:22 pm, IAmNan  wrote:> As always, Fred, 
> thanks for your reply.
>
> > The example you give works until you include a join, then you get
> > strings again.
>
> > Order.joins(:sales).group(:product_id).sum(:quantity)
>
> Quantity isn't on the model actually being queried so this doesn't
> surprise me. It does suck though. It looks like the sqlite3 driver is
> just smarter about asking the db for the types of the columns (I think
> that with sqlite3 you sort of don't have a choice the way the api is
> written, whereas with mysql you get all the columns as strings "for
> free". I could be wrong though. I don't know what the postgres api is
> like at all).
>
> Fred
>
>
>
>
>
>
>
> > That returns strings again. I don't think I did anything AR shouldn't
> > be aware of. BTW, the product_id is returned as a string too. I've
> > verified that SQLite3 returns numbers for both. This really seems
> > broken to me.
>
> > Order has_many :sales
> > Sale belongs_to :order
> > Order has a ordered_at datetime and the seller_id, Sale has the
> > product_id and quantity. This is why I need the join. (Oh, and Sale is
> > actually LineItem/line_item, although I doubt that makes a
> > difference.)
>
> > d.
>
> > On Jan 11, 1:14 pm, Frederick Cheung 
> > wrote:
>
> > > On Jan 11, 4:47 pm, IAmNan  wrote:
>
> > > > I wrote this question on RoRTalk back in August but haven't heard back
> > > > yet:http://tinyurl.com/4ohxdnf. So I think I must've been unclear.
>
> > > > Assume you have a Sale model with just a product Id and a quantity
> > > > sold. You want to see a total number of sales for each product.
>
> > > > Product.group(:product_id).select("product_id, sum(quantity) as
> > > > total_quantity")
>
> > > > Let's collect just the totals to see what they look like in irb:
> > > > Product.group(:product_id).select("product_id, sum(quantity) as
> > > > total_quantity").map(&:total_quantity)
>
> > > > In SQLite (and MySQL I think) I get the following:
> > > > => [293.00, 4.00, 76.00, 9.00, 370.25, 71.00]
>
> > > > BUT! PostgreSQL returns this:
> > > > => ["293.00", "4.00", "76.00", "9.00", "370.25", "71.00"]
>
> > > > Strings! Why strings!? Am I doing something wrong? Why is this
> > > > happening, how do I fix it, and why doesn't ActiveRecord protect poor
> > > > little me from the mean world of db inconsistencies? ;)
>
> > > In general AR doesn't know the type of non column expressions.
> > > If you did something like Product..group(:product_id).sum(:quantity)
> > > then AR knows you're doing a sum, and it knows that the sum of
> > > decimals should be decimals so it would cast what it got back from the
> > > db to the appropriate type
>
> > > Fred
>
> > > > Thank in advance.
> > > > PS Quantity is a decimal in the schema.

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



[Rails] Re: PostgreSQL aggregate function inconsistent (returns strings)

2011-01-12 Thread Frederick Cheung


On Jan 12, 7:22 pm, IAmNan  wrote:
> As always, Fred, thanks for your reply.
>
> The example you give works until you include a join, then you get
> strings again.
>
> Order.joins(:sales).group(:product_id).sum(:quantity)
>
Quantity isn't on the model actually being queried so this doesn't
surprise me. It does suck though. It looks like the sqlite3 driver is
just smarter about asking the db for the types of the columns (I think
that with sqlite3 you sort of don't have a choice the way the api is
written, whereas with mysql you get all the columns as strings "for
free". I could be wrong though. I don't know what the postgres api is
like at all).

Fred

> That returns strings again. I don't think I did anything AR shouldn't
> be aware of. BTW, the product_id is returned as a string too. I've
> verified that SQLite3 returns numbers for both. This really seems
> broken to me.
>
> Order has_many :sales
> Sale belongs_to :order
> Order has a ordered_at datetime and the seller_id, Sale has the
> product_id and quantity. This is why I need the join. (Oh, and Sale is
> actually LineItem/line_item, although I doubt that makes a
> difference.)
>
> d.
>
> On Jan 11, 1:14 pm, Frederick Cheung 
> wrote:
>
>
>
> > On Jan 11, 4:47 pm, IAmNan  wrote:
>
> > > I wrote this question on RoRTalk back in August but haven't heard back
> > > yet:http://tinyurl.com/4ohxdnf. So I think I must've been unclear.
>
> > > Assume you have a Sale model with just a product Id and a quantity
> > > sold. You want to see a total number of sales for each product.
>
> > > Product.group(:product_id).select("product_id, sum(quantity) as
> > > total_quantity")
>
> > > Let's collect just the totals to see what they look like in irb:
> > > Product.group(:product_id).select("product_id, sum(quantity) as
> > > total_quantity").map(&:total_quantity)
>
> > > In SQLite (and MySQL I think) I get the following:
> > > => [293.00, 4.00, 76.00, 9.00, 370.25, 71.00]
>
> > > BUT! PostgreSQL returns this:
> > > => ["293.00", "4.00", "76.00", "9.00", "370.25", "71.00"]
>
> > > Strings! Why strings!? Am I doing something wrong? Why is this
> > > happening, how do I fix it, and why doesn't ActiveRecord protect poor
> > > little me from the mean world of db inconsistencies? ;)
>
> > In general AR doesn't know the type of non column expressions.
> > If you did something like Product..group(:product_id).sum(:quantity)
> > then AR knows you're doing a sum, and it knows that the sum of
> > decimals should be decimals so it would cast what it got back from the
> > db to the appropriate type
>
> > Fred
>
> > > Thank in advance.
> > > PS Quantity is a decimal in the schema.

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



[Rails] Re: WickedPDF vs PDFKit vs. Prawn, etc.

2011-01-12 Thread Marnen Laibow-Koser
Garrett Lancaster wrote in post #974445:
> Thoughts on using WickedPDF vs PDFKit vs. Prawn or others for developing
> forms with dynamic content?

I use Prawn, and might try WickedPDF at some point.  Correct me if I'm 
wrong, but isn't PDFKit meant for manipulating existing PDF files, not 
producing them from scratch, unlike the other two?

>
> TIA,
> Garrett Lancaster

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

Sent from my iPhone

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

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



[Rails] WickedPDF vs PDFKit vs. Prawn, etc.

2011-01-12 Thread Garrett Lancaster
Thoughts on using WickedPDF vs PDFKit vs. Prawn or others for developing 
forms with dynamic content?


TIA,
Garrett Lancaster

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



[Rails] Re: Re: refactoring models

2011-01-12 Thread Marnen Laibow-Koser
Peter Bell wrote in post #974422:
> It probably is, but why were you putting the data into a database? If
> there's a valid reason to do that, do it and then fix db performance
> with caching if it becomes a limiting factor.
>
> If there's not a valid reason to put the data into a database, why would
> you do so? Start with the simplest thing that would possibly work to get
> your tests passing and go from there.
[...]

With Rails, sometimes using a DB is the simplest thing, and it's 
actually harder not to do so.  But I agree with the sentiment.

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

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

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



Re: [Rails] Re: Re: How to get geo location with the help of IP address

2011-01-12 Thread Hassan Schroeder
On Wed, Jan 12, 2011 at 8:33 AM, Didde Brockman  wrote:

> I'm not so sure. It depends on the use case, IMHO.

+1

If the OP only needs the *country* identified, GeoIP on the server is
the easiest solution.

For any finer granularity, GeoIP (or any IP-based system) is not very
reliable. (At the moment I'm in a moving vehicle south of Pismo Beach
California, and GeoIP thinks I'm in Manteca -- *way* off.)

But the client-side solutions are still a work in progress too, AFAICT  :-)

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



[Rails] Re: undefined method 'xxx' for {}:Hash rake db:migrate

2011-01-12 Thread Frederick Cheung


On Jan 12, 4:45 pm, Billy  wrote:
> Hi
>
> I just installed rails 3 (3.0.3) and am trying to create a rake task.
> I am seeing this:
>
> rake aborted!
> undefined method `name' for #
>
> my rake task (simplified) is as follows:
>
> namespace :app do
>   desc 'Create dummy data'
>   task :setup => :environment do
>     [
>       { :name => 'Test User',   :email => 't...@xxx.com' },
>     ].each do |client|
>       puts '-'
>       puts client.name
>     end
>   end
> end

Your code just looks wrong to me - you're iterating over an array of
hashes, so client is a hash. Hashes don't have a name method so
client.name blows up. Did you mean client[:name]  or intend to use
that data to create an active record object first?

Fred
>
> Its barfing on that puts client.name
>
> This appears to be an older bug.  The solution hinted at here
>
> http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/...name'+for+%23%3CHash#fded05c2c519a31f
>
> is not working for me as rails 3 has a strong dependency on rake
> 0.8.7.
>
> Anyone else seeing this problem?

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



[Rails] Encoding error when trying to write file

2011-01-12 Thread Erwin
[Rails 3 - Ruby 1.9.2]

I have to get email attachments ( mp4 files ) and store them...
I get easily all parts using Mail  (   )

attachment  = mail.attachments[0]
#, ,   >
got what I need,

but trying to store this attachment in a temp file , I get an encoding
error :

 File.open(filepath,File::CREAT|File::TRUNC|File::WRONLY,0644) { |
f| f.write(attachment.body) }

   Encoding::UndefinedConversionError Exception: "\x80" from
ASCII-8BIT to UTF-8

did I miss anything before writing the file ? or is it a known Ruby
bug ?
being an .mp4 attachment, it should be a binary file.. it comes as an
UTF-8 ( Base64) ? , right...
how should I write it as a binary too ?

tfyh


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



Re: [Rails] Re: (JOB) Ruby on Rails Developers- Strongmail , Redwood Shores, CA

2011-01-12 Thread Peter Bell
Wow - I'm in awe! I came across the web in '94 but didn't get commercial 
clients for building web apps until '96. I didn't think that was horrible, but 
clearly I'm a short timer at this web application development stuff with only 
15 years experience :)

Best Wishes,
Peter

On Jan 12, 2011, at 12:58 PM, dkerins wrote:

> The University of Victoria (Fine Arts Faculty) had a donation from Sun
> of their workstations back in 1992-3 and I was hired as a junior
> admin.  Around 1993-4, part of my job was creating web pages on SunOS
> with HoTMetaL as an html editor and using NCSA Mosaic as the browser
> and the CERN httpd daemon.  As cool as that was, I was totally blown
> away by playing netrek on the server at Carnegie Mellon University
> with people all over the continent.
> 
> In retrospect, it was pretty cool to have stumbled upon the early web
> as a naive young student.  Since them, the changes and the speed of
> change is awe inspiring.
> 
> On Jan 11, 6:08 am, Peter Bell  wrote:
>> On Jan 10, 2011, at 7:51 PM, Michelle wrote:
>> 
>>> 2-20+ years of experience developing web based applications
>> 
>> I was just about to joke about wanting to find someone outside of CERN with 
>> 20+ years of web app experience, but it looks like we're getting close to it 
>> being an accurate number (http://en.wikipedia.org/wiki/HTTP#History). Now 
>> I'm feeling a latecomer - I didn't start doing web dev until '96 :(
>> 
>> Anyone here actually doing any commercial dev using http pre '94 (pre 
>> Netscape)?
>> 
>> Best Wishes,
>> Peter
> 
> -- 
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] undefined method 'xxx' for {}:Hash rake db:migrate

2011-01-12 Thread Colin Law
On 12 January 2011 16:45, Billy  wrote:
> Hi
>
> I just installed rails 3 (3.0.3) and am trying to create a rake task.
> I am seeing this:
>
> rake aborted!
> undefined method `name' for #
>
> my rake task (simplified) is as follows:
>
> namespace :app do
>  desc 'Create dummy data'
>  task :setup => :environment do
>    [
>      { :name => 'Test User',   :email => 't...@xxx.com' },
>    ].each do |client|
>      puts '-'
>      puts client.name

Should that be client[:name]

Colin

>    end
>  end
> end
>
> Its barfing on that puts client.name
>
> This appears to be an older bug.  The solution hinted at here
>
> http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/d3e6af81dcbcce31/fded05c2c519a31f?lnk=gst&q=rake+aborted!+undefined+method+`name'+for+%23%3CHash#fded05c2c519a31f
>
> is not working for me as rails 3 has a strong dependency on rake
> 0.8.7.
>
> Anyone else seeing this problem?
>
>
> --
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: refactoring models

2011-01-12 Thread Peter Bell
It probably is, but why were you putting the data into a database? If there's a 
valid reason to do that, do it and then fix db performance with caching if it 
becomes a limiting factor.

If there's not a valid reason to put the data into a database, why would you do 
so? Start with the simplest thing that would possibly work to get your tests 
passing and go from there.

There was some discourse on one of the agile-like lists (maybe the XP list) 
recently with some people suggesting you shouldn't actually add support for a 
db to an app until you have the first test that won't pass simply by using in 
memory representations. That's a little extreme for me, but certainly I 
wouldn't put stuff into a db unless there was a good reason. And if there is a 
good reason for it being there, I wouldn't remove it for performance reasons 
until I had failing performance tests and profiling that pointed to that query 
as being part of my problem.

Google "premature optimization"

Best Wishes,
Peter

On Jan 12, 2011, at 4:45 PM, Me wrote:

> I would think that a select box populated by an array or hash is MUCH faster 
> and less system intensive than doing any db lookup.
> 
> -- 
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: (JOB) Ruby on Rails Developers- Strongmail , Redwood Shores, CA

2011-01-12 Thread dkerins
The University of Victoria (Fine Arts Faculty) had a donation from Sun
of their workstations back in 1992-3 and I was hired as a junior
admin.  Around 1993-4, part of my job was creating web pages on SunOS
with HoTMetaL as an html editor and using NCSA Mosaic as the browser
and the CERN httpd daemon.  As cool as that was, I was totally blown
away by playing netrek on the server at Carnegie Mellon University
with people all over the continent.

In retrospect, it was pretty cool to have stumbled upon the early web
as a naive young student.  Since them, the changes and the speed of
change is awe inspiring.

On Jan 11, 6:08 am, Peter Bell  wrote:
> On Jan 10, 2011, at 7:51 PM, Michelle wrote:
>
> > 2-20+ years of experience developing web based applications
>
> I was just about to joke about wanting to find someone outside of CERN with 
> 20+ years of web app experience, but it looks like we're getting close to it 
> being an accurate number (http://en.wikipedia.org/wiki/HTTP#History). Now I'm 
> feeling a latecomer - I didn't start doing web dev until '96 :(
>
> Anyone here actually doing any commercial dev using http pre '94 (pre 
> Netscape)?
>
> Best Wishes,
> Peter

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



Re: [Rails] Re: Re: How to get geo location with the help of IP address

2011-01-12 Thread Peter Hickman
Or you could use the geoip gem :)

http://ruby.about.com/od/gems/a/geoip.htm

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



[Rails] undefined method 'xxx' for {}:Hash rake db:migrate

2011-01-12 Thread Billy
Hi

I just installed rails 3 (3.0.3) and am trying to create a rake task.
I am seeing this:

rake aborted!
undefined method `name' for #

my rake task (simplified) is as follows:

namespace :app do
  desc 'Create dummy data'
  task :setup => :environment do
[
  { :name => 'Test User',   :email => 't...@xxx.com' },
].each do |client|
  puts '-'
  puts client.name
end
  end
end

Its barfing on that puts client.name

This appears to be an older bug.  The solution hinted at here

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/d3e6af81dcbcce31/fded05c2c519a31f?lnk=gst&q=rake+aborted!+undefined+method+`name'+for+%23%3CHash#fded05c2c519a31f

is not working for me as rails 3 has a strong dependency on rake
0.8.7.

Anyone else seeing this problem?


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



Re: [Rails] Re: refactoring models

2011-01-12 Thread Me
I would think that a select box populated by an array or hash is MUCH faster 
and less system intensive than doing any db lookup.

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



Re: [Rails] Re: refactoring models

2011-01-12 Thread Colin Law
On 12 January 2011 21:14, Me  wrote:

To repeat, please quote the message you are replying to.  Thanks

> not sure what else to say.  If you have a db table with 2 lines that are
> never going to change.  You refactor that into the other model that
> references it and remove the original AR model.  I was wondering, when you
> remove the table if you were to keep the original model but refactor the
> stuf into that mode instead of the referring model does it consume the same
> memory, BW, whatever, as opposed to the AR version of the model.

A key fact missing previously was that you have a very small table and
could just hard code the data.
The answer is who cares?  Don't worry about it unless you have
performance or resource problems, in which case profile the code to
find out where the problem lies and then address it.  I can virtually
guarantee that the bottlenecks or resource hogs will not be in the
areas you might anticipate beforehand.

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



Re: [Rails] best ui toolkit?

2011-01-12 Thread Mauro
On 10 January 2011 18:40, Peter De Berdt  wrote:

>
> It should be clear by now that gems/plugins for javascript generation are to
> be avoided. Not only will it generate ugly inline code in most cases, but
> you also lose a lot of control. If you want to use Javascript, then write
> Javascript, don't let some ruby gem write the code for you.

I'm trying using the pure jquery jqgrid.
I've write the javascript code to display a datagrid, I get the code
from jqgrid demos http://trirand.com/blog/jqgrid/jqgrid.html#.
Now I have great problem to take data from a rails model.
I don't know how and there isn't examples.

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



[Rails] Re: Would love to hear feedback regarding my first Rails project

2011-01-12 Thread Manuel Kiessling
Thanks Dermot, really cool you took the time to go into detail, that 
helps a lot.

I will rewrite stuff as you suggested, and I will look at Cells!

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



Re: [Rails] Re: refactoring models

2011-01-12 Thread Peter Bell
Just to be clear, what specific performance tests are you having a problem 
with? 

Refactoring for better readability/maintainability every time your tests are 
green is a good practice. 

Trying to make micro-optimizations in memory profile, sql queries, caching, etc 
without a specific failing performance test and profiling results showing which 
query or page load is causing the problem just burns time and obfuscates your 
code. Apart from anything else, the things that make your app slow are probably 
not those that you expect it to be.

The only thing I would say is that if you have a transient object that doesn't 
require persistence (I have a location object in a new app - I don't store 
locations - I just use them to handle geocoding and to return a list of places 
from a third party service) from what I understand (I'm still new to best Rails 
practices), it's quite reasonable to put that in the lib directory. I wouldn't 
wrap an entire AR lifecycle around a Class that I did not plan to persist the 
instances of. But that's not to improve performance (although it might in some 
way) but because it seems more semantically accurate - it better expresses my 
intent.

Best Wishes,
Peter

On Jan 12, 2011, at 4:14 PM, Me wrote:

> not sure what else to say.  If you have a db table with 2 lines that are 
> never going to change.  You refactor that into the other model that 
> references it and remove the original AR model.  I was wondering, when you 
> remove the table if you were to keep the original model but refactor the stuf 
> into that mode instead of the referring model does it consume the same 
> memory, BW, whatever, as opposed to the AR version of the model.
> 
> -- 
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: refactoring models

2011-01-12 Thread Me
not sure what else to say.  If you have a db table with 2 lines that are 
never going to change.  You refactor that into the other model that 
references it and remove the original AR model.  I was wondering, when you 
remove the table if you were to keep the original model but refactor the 
stuf into that mode instead of the referring model does it consume the same 
memory, BW, whatever, as opposed to the AR version of the model.

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



Re: [Rails] Re: refactoring models

2011-01-12 Thread Colin Law
On 12 January 2011 18:32, Me  wrote:

Please quote the previous message and insert your comments at the
appropriate points.  It makes it easier to follow the thread.  Thanks.

> OK from my first post.  I am refactoring trying to make my app lean and
> agile.  The less models loaded up the less memory obviously.

Not necessarily.  In terms of resources just loading models I would
think it is more down to lines of code than number of models.

>  I was curious
> if refactored out the DB portion and left the ruby model if it would have a
> noticeable impact

Perhaps I am being particularly dense today, again I do not understand
what you mean by refactoring out the db portion and leaving the Ruby
model.

> or whether getting rid of the model and refactor into
> another on needed  is a better way to lean the app.

Do you mean combining non-AR models or what?

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



[Rails] Re: Scheduled tasks on rails

2011-01-12 Thread Owain
>
> Look at local_request? method in ActionController.
>

Jeffrey,

Certainly another option but I would prefer not to have "network
config" logic in my application if I can help it.  If you want to
manage all of the housekeeping jobs from a remote curl or put in load
balancers you would need to change code.  I prefer to protect
resources like this in my httpd.conf that defines the server and
network environment.

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



[Rails] Re: Can I omit respond_with.

2011-01-12 Thread Marnen Laibow-Koser
Msan Msan wrote in post #974376:
> On 12 January 2011 17:34, Garrett Lancaster
> wrote:
>
>>  Google for respond_with:
>> http://apidock.com/rails/ActionController/MimeResponds/respond_with
>>
>
> Didn't know apidock.com.

I find http://www.railsapi.com a lot more attractive, but APIdock has a 
couple of cool features.

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

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

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



Re: [Rails] Re: Re: flash messages in locale file, what' worng?

2011-01-12 Thread Mauro
On 12 January 2011 18:32, Tim Shaffer  wrote:
> You do have the "responders" gem installed, in your Gemfile, and setup in
> your application_controller.rb, correct?

I think yes.

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



[Rails] Re: PostgreSQL aggregate function inconsistent (returns strings)

2011-01-12 Thread IAmNan
As always, Fred, thanks for your reply.

The example you give works until you include a join, then you get
strings again.

Order.joins(:sales).group(:product_id).sum(:quantity)

That returns strings again. I don't think I did anything AR shouldn't
be aware of. BTW, the product_id is returned as a string too. I've
verified that SQLite3 returns numbers for both. This really seems
broken to me.

Order has_many :sales
Sale belongs_to :order
Order has a ordered_at datetime and the seller_id, Sale has the
product_id and quantity. This is why I need the join. (Oh, and Sale is
actually LineItem/line_item, although I doubt that makes a
difference.)

d.

On Jan 11, 1:14 pm, Frederick Cheung 
wrote:
> On Jan 11, 4:47 pm, IAmNan  wrote:
>
>
>
>
>
>
>
>
>
> > I wrote this question on RoRTalk back in August but haven't heard back
> > yet:http://tinyurl.com/4ohxdnf. So I think I must've been unclear.
>
> > Assume you have a Sale model with just a product Id and a quantity
> > sold. You want to see a total number of sales for each product.
>
> > Product.group(:product_id).select("product_id, sum(quantity) as
> > total_quantity")
>
> > Let's collect just the totals to see what they look like in irb:
> > Product.group(:product_id).select("product_id, sum(quantity) as
> > total_quantity").map(&:total_quantity)
>
> > In SQLite (and MySQL I think) I get the following:
> > => [293.00, 4.00, 76.00, 9.00, 370.25, 71.00]
>
> > BUT! PostgreSQL returns this:
> > => ["293.00", "4.00", "76.00", "9.00", "370.25", "71.00"]
>
> > Strings! Why strings!? Am I doing something wrong? Why is this
> > happening, how do I fix it, and why doesn't ActiveRecord protect poor
> > little me from the mean world of db inconsistencies? ;)
>
> In general AR doesn't know the type of non column expressions.
> If you did something like Product..group(:product_id).sum(:quantity)
> then AR knows you're doing a sum, and it knows that the sum of
> decimals should be decimals so it would cast what it got back from the
> db to the appropriate type
>
> Fred
>
>
>
>
>
>
>
>
>
> > Thank in advance.
> > PS Quantity is a decimal in the schema.

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



Re: [Rails] Can I omit respond_with.

2011-01-12 Thread Mauro
On 12 January 2011 17:34, Garrett Lancaster
wrote:

>  Google for respond_with:
> http://apidock.com/rails/ActionController/MimeResponds/respond_with
>

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



Re: [Rails] Re: Scheduled tasks on rails

2011-01-12 Thread Jeffrey L. Taylor
Quoting Owain :
> 
> 
> On Jan 12, 2:54 pm, "Donald R. Ziesig"  wrote:
> >   Douglas,
> >
> > I have been using cron tasks that invoke curl that invokes the routes
> > that perform the periodic tasks for several years.
> 
> Do you wrap some security on those routes at the web-server level or
> in the application? If you secure at the webserver, do you do it by ip
> address or user/password
> 

Look at local_request? method in ActionController.

HTH,
  Jeffrey

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



Re: [Rails] [ANN] TrackHistory: An easy way to track changes

2011-01-12 Thread Me
acts_as_audited or acts_as_versioned, things like that.

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



Re: [Rails] Re: refactoring models

2011-01-12 Thread Me
OK from my first post.  I am refactoring trying to make my app lean and 
agile.  The less models loaded up the less memory obviously.  I was curious 
if refactored out the DB portion and left the ruby model if it would have a 
noticeable impact or whether getting rid of the model and refactor into 
another on needed  is a better way to lean the app.  I am following the 
Rails anitpatterns book for this stuff.

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



Re: [Rails] Re: refactoring models

2011-01-12 Thread Colin Law
On 12 January 2011 18:15, Me  wrote:
> rails models:
> class me
> end
> class me < ActiveRecord::Base
> end
> Does the rails AR one use much more system resources than the ruby class?
>  Other than the methods being defined for the AR one.

Are you asking whether a class derived from ActiveRecord::Base uses
more resources than one not so derived, apart from the resources used
by ActiveRecord::Base?  Sorry that seems to me to be not a useful
question to ask.  As I said previously if you could give some
background as to why you are asking the question it may make more
sense to me.

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



Re: [Rails] Re: refactoring models

2011-01-12 Thread Me
rails models:

class me 

end

class me < ActiveRecord::Base

end

Does the rails AR one use much more system resources than the ruby class? 
 Other than the methods being defined for the AR one.

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



Re: [Rails] Re: refactoring models

2011-01-12 Thread Colin Law
On 12 January 2011 17:59, Me  wrote:
> anybody?

Perhaps you could explain in more detail what you mean.  Give an
example of the comparison you are trying to make.

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



[Rails] Re: refactoring models

2011-01-12 Thread Me
anybody?

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



Re: [Rails] Re: Re: Re: IE empty params

2011-01-12 Thread Colin Law
On 12 January 2011 17:21, Roger Correia  wrote:
> ...
> Thks for ur concern Colin. I even created a simple-mini app just using
> the standard Rails Scaffold, in order to isolate the problem. And it
> still remains. The main difference is that, in FF it passes (besides the
> necessary parameteres) the "authenticity_token" and the "commit".
>
> PS: I had to turn off protect_from_forgery in the
> application_controller.rb in order to get it working in IE. Or else i'd
> get a "invalid authenticity token".
>
> Internet Explorer:
> Started POST "/people" for xxx at Wed Jan 12 17:15:22 + 2011
>  Processing by PeopleController#create as HTML
> 
> ** Application Controller :: Authorizer
> 
> ** PArams: {"action"=>"create", "controller"=>"people"}
> ** CREATE
> ** Params: {"action"=>"create", "controller"=>"people"}
>  SQL (0.1ms)  BEGIN
>  SQL (19.7ms)  INSERT INTO `people` (`age`, `created_at`, `name`,
> `telephone`, `updated_at`) VALUES (NULL, '2011-01-12 17:15:22', NULL,
> NULL, '2011-01-12 17:15:22')
>  SQL (5.6ms)  COMMIT
> Redirected to http://.. (OMITED)
> Completed 302 Found in 35ms
>
> FireFox:
>
> Started POST "/people" for xxx at Wed Jan 12 17:15:43 + 2011
>  Processing by PeopleController#create as HTML
>  Parameters: {"commit"=>"Create Person", "person"=>{"name"=>"dasd",
> "telephone"=>"34243", "age"=>"3242"},
> "authenticity_token"=>"6U9cHxuI6gW3WPbZoe+i93Tbu+oWjohdv+nuwb/8QXY=",
> "utf8"=>"â"}
> 
> ** Application Controller :: Authorizer
> 
> ** PArams: {"commit"=>"Create Person", "person"=>{"name"=>"dasd",
> "telephone"=>"34243", "age"=>"3242"},
> "authenticity_token"=>"6U9cHxuI6gW3WPbZoe+i93Tbu+oWjohdv+nuwb/8QXY=",
> "utf8"=>"â", "action"=>"create", "controller"=>"people"}
> ** CREATE
> ** Params: {"commit"=>"Create Person", "person"=>{"name"=>"dasd",
> "telephone"=>"34243", "age"=>"3242"},
> "authenticity_token"=>"6U9cHxuI6gW3WPbZoe+i93Tbu+oWjohdv+nuwb/8QXY=",
> "utf8"=>"â", "action"=>"create", "controller"=>"people"}
>  SQL (0.1ms)  BEGIN
>  SQL (0.2ms)  INSERT INTO `people` (`age`, `created_at`, `name`,
> `telephone`, `updated_at`) VALUES (3242, '2011-01-12 17:15:43', 'dasd',
> 34243, '2011-01-12 17:15:43')
>  SQL (7.8ms)  COMMIT
> Redirected to http://.. (OMITED)
> Completed 302 Found in 18ms

Could it be this?
http://lists.rubyonrails.org/pipermail/rails/2006-March/027283.html
It is ancient and I can't say I understand it, but the log looks very
like yours.

Otherwise I have reached the end of my knowledge span I think.

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



Re: [Rails] Re: Re: flash messages in locale file, what' worng?

2011-01-12 Thread Tim Shaffer
You do have the "responders" gem installed, in your Gemfile, and setup in 
your application_controller.rb, correct?

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



[Rails] Re: Re: Re: IE empty params

2011-01-12 Thread Roger Correia
Colin Law wrote in post #974329:
> On 12 January 2011 15:20, Roger Correia  wrote:
>> [...]
>> Yes i've also tried the complete source, i am not using javascript and i
>> upgraded today for Rails 3.0.3 and the problem persists.. I just cant
>> understand why it works when i take the NTLM auth method out of the
>> picture..
>
> If you look at the app log and compare it between FF and IE what
> differences do you see?
>
> You could post the relevant bits of log if appropriate.
>
> Colin

Thks for ur concern Colin. I even created a simple-mini app just using
the standard Rails Scaffold, in order to isolate the problem. And it
still remains. The main difference is that, in FF it passes (besides the
necessary parameteres) the "authenticity_token" and the "commit".

PS: I had to turn off protect_from_forgery in the
application_controller.rb in order to get it working in IE. Or else i'd
get a "invalid authenticity token".

Internet Explorer:
Started POST "/people" for xxx at Wed Jan 12 17:15:22 + 2011
  Processing by PeopleController#create as HTML

** Application Controller :: Authorizer

** PArams: {"action"=>"create", "controller"=>"people"}
** CREATE
** Params: {"action"=>"create", "controller"=>"people"}
  SQL (0.1ms)  BEGIN
  SQL (19.7ms)  INSERT INTO `people` (`age`, `created_at`, `name`,
`telephone`, `updated_at`) VALUES (NULL, '2011-01-12 17:15:22', NULL,
NULL, '2011-01-12 17:15:22')
  SQL (5.6ms)  COMMIT
Redirected to http://.. (OMITED)
Completed 302 Found in 35ms

FireFox:

Started POST "/people" for xxx at Wed Jan 12 17:15:43 + 2011
  Processing by PeopleController#create as HTML
  Parameters: {"commit"=>"Create Person", "person"=>{"name"=>"dasd",
"telephone"=>"34243", "age"=>"3242"},
"authenticity_token"=>"6U9cHxuI6gW3WPbZoe+i93Tbu+oWjohdv+nuwb/8QXY=",
"utf8"=>"â"}

** Application Controller :: Authorizer

** PArams: {"commit"=>"Create Person", "person"=>{"name"=>"dasd",
"telephone"=>"34243", "age"=>"3242"},
"authenticity_token"=>"6U9cHxuI6gW3WPbZoe+i93Tbu+oWjohdv+nuwb/8QXY=",
"utf8"=>"â", "action"=>"create", "controller"=>"people"}
** CREATE
** Params: {"commit"=>"Create Person", "person"=>{"name"=>"dasd",
"telephone"=>"34243", "age"=>"3242"},
"authenticity_token"=>"6U9cHxuI6gW3WPbZoe+i93Tbu+oWjohdv+nuwb/8QXY=",
"utf8"=>"â", "action"=>"create", "controller"=>"people"}
  SQL (0.1ms)  BEGIN
  SQL (0.2ms)  INSERT INTO `people` (`age`, `created_at`, `name`,
`telephone`, `updated_at`) VALUES (3242, '2011-01-12 17:15:43', 'dasd',
34243, '2011-01-12 17:15:43')
  SQL (7.8ms)  COMMIT
Redirected to http://.. (OMITED)
Completed 302 Found in 18ms

Thanks once again.

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



Re: [Rails] Can I omit respond_with.

2011-01-12 Thread Garrett Lancaster

Google for respond_with:
http://apidock.com/rails/ActionController/MimeResponds/respond_with

Garrett Lancaster




Mauro 
January 12, 2011 2:34 AM




def create
@user = User .new

(params[:user])
flash[:notice] = 'User was successfully created.' if @user.save
respond_with(@user)
end

is the same as:

def create
@user = User .new

(params[:user])

respond_to do |format|
if @user.save
flash[:notice] = 'User was successfully created.'
format.html { redirect_to(@user) }
format.xml { render :xml => @user, :status => :created, :location
=> @user }
else
format.html { render :action => "new" }
format.xml { render :xml => @user.errors, :status =>
:unprocessable_entity }
end
end
end

It's just built into the method.


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



Garrett Lancaster 
January 11, 2011 4:45 PM


def create
@user = User .new 
(params[:user])

flash[:notice] = 'User was successfully created.' if @user.save
respond_with(@user)
end

is the same as:

def create
@user = User .new 
(params[:user])


respond_to do |format|
if @user.save
flash[:notice] = 'User was successfully created.'
format.html { redirect_to(@user) }
format.xml { render :xml => @user, :status => :created, :location => 
@user }

else
format.html { render :action => "new" }
format.xml { render :xml => @user.errors, :status => 
:unprocessable_entity }

end
end
end

It's just built into the method.

Garrett Lancaster




Mauro 
January 11, 2011 4:11 PM




If you don't provide a redirect_to, it will assume a view with
name create.html.erb or create.html.haml, etc. and try to render
it giving you a missing template.  The most common design is
create redirects to @model and destroy redirects to index_path.


If I put in create respond_with, for example respond_with(@sector) it 
seems that redirects automatically to show while respond_with(@sector) 
in destroy redirects to index.

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



Garrett Lancaster 
January 11, 2011 4:02 PM


If you don't provide a redirect_to, it will assume a view with name 
create.html.erb or create.html.haml, etc. and try to render it giving 
you a missing template.  The most common design is create redirects to 
@model and destroy redirects to index_path.


Garrett Lancaster



Mauro 
January 11, 2011 3:58 PM




Yes, you can omit respond_with. Most of my apps are entirely
without respond_with calls unless I have an explicit need for xml,
etc.


If I omit respond_with in some actions like create and destroy raise 
an error of missing template.

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

Re: [Rails] Re: Re: How to get geo location with the help of IP address

2011-01-12 Thread Didde Brockman
On Jan 12, 2011, at 5:07 PM, Marnen Laibow-Koser wrote:

> Didde Brockman wrote in post #974306:
>> On Jan 12, 2011, at 7:43 AM, Marnen Laibow-Koser wrote:
>> 
>>> Rajesh B. wrote in post #974156:
 i am developing a product where i need to know from wich country the
 user is logged in .! and display things according to his geolocation .
 can any one please help me out with this
>> 
>> Great! Geolocation is always fun.
>> 
>>> Perhaps you want to use the new HTML 5 geolocation features.  If not,
>>> Google has a similar API available to the public.  This is an HTML/JS
>>> issue and has nothing to do with Rails.
>> 
>> You may be correct in this statement, but there's also the option of
>> segmenting the content on the server side. I.e., in Rails.
> 
> Well, of course Rails should *deal with* the data once acquired.  But 
> acquiring the user's location is a job for the client side, isn't it?

I'm not so sure. It depends on the use case, IMHO.

For example. Say you have http://www.mysite.com/ which needs to redirect the 
visitor to http://www.mysite.co.uk/ if the originating IP resolves to the UK. 
Using your method, a page would need to load, determine the geographical 
location and then use meta refresh or a Javascript in order to perform the 
actual redirect.

Using GeoIP on the server side, a redirect_to in the controller could take care 
of it all in one quick action.

But again, it all depends on what you need to do. If it's a matter of simply 
varying some sort of UI element, the client side way makes sense.

Your mileage may vary  :)

> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] [ANN] TrackHistory: An easy way to track changes

2011-01-12 Thread Walter Lee Davis


On Jan 12, 2011, at 9:40 AM, John Crepezzi wrote:


Hey guys,

I made a gem for tracking changes on specific fields in ActiveRecord
models.
Its very easy to get started using, and automatically creates models
and
associations to history objects which contain the changes made.



This looks very promising! Is there any magic in it to roll back to a  
previous state? Or is that out of scope for what it's meant to do?


Walter

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



Re: [Rails] Re: Re: IE empty params

2011-01-12 Thread Colin Law
On 12 January 2011 15:20, Roger Correia  wrote:
> [...]
> Yes i've also tried the complete source, i am not using javascript and i
> upgraded today for Rails 3.0.3 and the problem persists.. I just cant
> understand why it works when i take the NTLM auth method out of the
> picture..

If you look at the app log and compare it between FF and IE what
differences do you see?

You could post the relevant bits of log if appropriate.

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



[Rails] Re: Scheduled tasks on rails

2011-01-12 Thread Owain


On Jan 12, 2:54 pm, "Donald R. Ziesig"  wrote:
>   Douglas,
>
> I have been using cron tasks that invoke curl that invokes the routes
> that perform the periodic tasks for several years.

Do you wrap some security on those routes at the web-server level or
in the application? If you secure at the webserver, do you do it by ip
address or user/password

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



[Rails] Re: Re: How to get geo location with the help of IP address

2011-01-12 Thread Marnen Laibow-Koser
Didde Brockman wrote in post #974306:
> On Jan 12, 2011, at 7:43 AM, Marnen Laibow-Koser wrote:
>
>> Rajesh B. wrote in post #974156:
>>> i am developing a product where i need to know from wich country the
>>> user is logged in .! and display things according to his geolocation .
>>> can any one please help me out with this
>
> Great! Geolocation is always fun.
>
>> Perhaps you want to use the new HTML 5 geolocation features.  If not,
>> Google has a similar API available to the public.  This is an HTML/JS
>> issue and has nothing to do with Rails.
>
> You may be correct in this statement, but there's also the option of
> segmenting the content on the server side. I.e., in Rails.

Well, of course Rails should *deal with* the data once acquired.  But 
acquiring the user's location is a job for the client side, isn't it?

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

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

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



[Rails] multiple fields_for on has_many relationship?

2011-01-12 Thread Michael Mike
I have a form for an ordered_special. An ordered_special has many
ordered_special_foods. Basically, within a loop in the form I am doing
something like the following:

<% special.foods.each do |food| -%>
<% fields_for OrderedSpecialFood.new do |os| %>
<% food.food_types.each do |food_type| -%>
<%= os.radio_button :food_type, food_type.id %> <%=
food_type.name %>
<% end -%>
<% end -%>
<% end -%>


So, I am trying to add OrderedSpecialFoods to the OrderedSpecial. The
problem is that I want the radio button to distinguish that we are
handling a different OrderedSpecialFood for each occurrence of the outer
loop. Right now, all of the radio buttons belong to the same group. I
understand why that is, but I want to distinguish between multiple new
OrderedSpecialFoods and I am not sure how to do that exactly. Any help
is appreciated.

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



Re: [Rails] Re: Re: flash messages in locale file, what' worng?

2011-01-12 Thread Mauro
On 12 January 2011 16:41, Kaleem Ullah  wrote:
> Then few problems in your code.
> 1)  'Flash' should be in lower case.
> 2)   'created' should be 'create' only.
>

Here is my it.yml:

flash:
actions:
  create:
notice: "OK"

I think it's ok but I don't see notices when I create.

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



[Rails] Re: Re: flash messages in locale file, what' worng?

2011-01-12 Thread Kaleem Ullah
Then few problems in your code.
1)  'Flash' should be in lower case.
2)   'created' should be 'create' only.

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



Re: [Rails] Re: flash messages in locale file, what' worng?

2011-01-12 Thread Mauro
On 12 January 2011 14:08, Kaleem Ullah  wrote:
> Msan Msan wrote in post #974172:
>> The controller:
>> def create
>>      Sector.new @ sector = (params [: sector])
>>      @ sector.save
>>      respond_with (@ sector)
>>    end
>>
>> in en.yml I put in the file:
>>
>> en:
>>    Flash:
>>      actions:
>>        created:
>>          notice: "ok"
>>
>> It seems correct but the message "ok" doesn't appears when
>> successfully created a new sector.
>
> I think you did not define flash message in your controller action.
> It should be like
>  def create
>  ...
>   if @sector.save
>    flash[:notice] = t('flash.actions.created.notice')
>   end
>  ...
>  end
>
> I have not tested it but give it a Try.

I've seen in http://blog.plataformatec.com.br/tag/respond_with/

it says:

def create
@post = Post.new(params[:post])
flash[:notice] = "Post was successfully created" if @post.save
respond_with(@post)
  end

Can now be written as:

  def create
@post = Post.new(params[:post])
@post.save
respond_with(@post)
  end

Your locale just needs to have the following configuration:
  flash:
actions:
  create:
notice: "{resource_name} was successfully created"
  update:
notice: "{resource_name} was successfully updated"
  destroy:
notice: "{resource_name} was successfully destroyed"
alert: "{resource_name} could not be destroyed"

there is no notice definition in action create.

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



Re: [Rails] Re: How to get geo location with the help of IP address

2011-01-12 Thread Didde Brockman
On Jan 12, 2011, at 7:43 AM, Marnen Laibow-Koser wrote:

> Rajesh B. wrote in post #974156:
>> i am developing a product where i need to know from wich country the
>> user is logged in .! and display things according to his geolocation .
>> can any one please help me out with this

Great! Geolocation is always fun.

> Perhaps you want to use the new HTML 5 geolocation features.  If not, 
> Google has a similar API available to the public.  This is an HTML/JS 
> issue and has nothing to do with Rails.

You may be correct in this statement, but there's also the option of segmenting 
the content on the server side. I.e., in Rails. It can arguably also be a nice 
attribute to have on a user model for future send-outs or similar.

Have a look at https://github.com/cjheath/geoip. Then check out 
http://www.maxmind.com/app/ip-location.

Good luck.

> Best,
> -- 
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org
> 
> Sent from my iPhone
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: IE empty params

2011-01-12 Thread Roger Correia
Colin Law wrote in post #973693:
> On 10 January 2011 16:27, Roger Correia  wrote:
>
> Please don't top post, it makes it difficult to follow the thread.
> Insert your comments into the previous post at appropriate points.
> Thanks
>
>> Colin, tks for you answer.
>>
>> Yes i isolated the form and ran the check and everything seemed ok. This
>> is really getting anoying, its been week like this..
>
> Did you copy/paste the *complete* source of the page?
>
> Are you using javascript?  If so try with firebug in firefox and see
> if it gives any errors.
>
> Could it be a Rails 3.0.0 issue?  Perhaps an upgrade to 3.0.3 would be
> advisable.
>
> Colin

Sorry for the bad posting.

Yes i've also tried the complete source, i am not using javascript and i 
upgraded today for Rails 3.0.3 and the problem persists.. I just cant 
understand why it works when i take the NTLM auth method out of the 
picture..

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



[Rails] iPhone and Rails 3.0

2011-01-12 Thread Sergio
Check out the iPhoneRails.org tutorial on creating an iPhone app to
extend the micropost sample application from the ruby on rails tutorial

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



[Rails] Re: Running Spork with rspec in Rails 3 on Windows 7

2011-01-12 Thread veldtmana
Hi David, I have installed autotest, I will look at Snarl

On Jan 12, 2:09 pm, David White  wrote:
> Rspec is compatible with Rails 3.https://github.com/rspec/rspec-rails
>
> Have you looked at autotest (part of ZenTest) to save having to rake spec
> all the time. I'm sure I came across a windows Rspec, Autotest and Snarl
> notifications tutorial on the web once. A quick search will probably find
> it.
>
> David White

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



Re: [Rails] Scheduled tasks on rails

2011-01-12 Thread Donald R. Ziesig

 Douglas,

I have been using cron tasks that invoke curl that invokes the routes 
that perform the periodic tasks for several years.  This works on all 
versions of Rails (of course you have to be running *nix).  I gave up on 
using Rails plugins, etc. because every time I did an update, the darned 
things broke (and now they seem to have gone away entirely).


Donz

On 1/11/2011 5:14 PM, Douglas Fonseca wrote:

Hi,
I'm developing a rails app that needs to run scheduled tasks, does 
someone knows how can I do that?

I've tried backgroundrb, but without success...
Looks like backgroundrb is outdated with my version of rails (3.0.3), 
Does anybody confirms?

Thanks in advance,
---
Douglas Fonseca
Engenharia da Computação 2010
Universidade Estadual de Campinas

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



Re: [Rails] Re: Rails 3 + mongodb => test problems

2011-01-12 Thread David White
No I wasn't 100% on using factory_girl with mongo but worth a try. 

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



[Rails] Re: auto save option in assoications

2011-01-12 Thread Kaleem Ullah
Here is the good guide.
http://edgeapi.rubyonrails.org/classes/ActiveRecord/AutosaveAssociation.html

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



Re: [Rails] JOB: coders/developers needed for social commerce site. Board consists of public company CEOs, VC founder and NFL athlete

2011-01-12 Thread Peter Hickman
On 12 January 2011 14:34, Peter Bell  wrote:
> Unless it was a test - figure out where we're located or you don't have the 
> initiative we want of applicants . . .

Could be but then again I don't look too closely at ads that don't
mention location so it could be seen as self defeating. Cryptic and
incompetent look much the same :)

But then why mention 'NFL athlete' in the subject line, is it meant to
pique our interest? Not sure I want to work somewhere where the
founder is a jock.

Tell me about the location, the offices, the local bagel shops, the pay.

I genuinely want to know why they included WAP and X-Windows. In an
interview I would judge the company on the answer they gave to such a
question.

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



[Rails] [ANN] TrackHistory: An easy way to track changes

2011-01-12 Thread John Crepezzi
Hey guys,

I made a gem for tracking changes on specific fields in ActiveRecord
models.
Its very easy to get started using, and automatically creates models
and
associations to history objects which contain the changes made.

If you have a table like:
users: (id, email, created_at)

And you'd like to track all of the changes the email has been through
over
time, in your model you'd just write:

class User < ActiveRecord::Base
  track_history
end

and create a table in a migration like:
user_histories: (id, user_id, email_before, email_after, created_at)

Automatically when you start up your server, user instances will have
#histories (an array of UserHistory objects) and UserHistory will have
some
convenience methods which you can read more about in the README.

You can also add annotations like:

class User < ActiveRecord::Base
  track_history do
annotate(:day_of_week) { Time.zone.now.wday }
  end
end

And the value of the annotation will be saved whenever the object is
updated.

There's are a bunch of other options to check out and configure,
such as the ability to track creates and deletes cleanly.

Check it out!
https://github.com/seejohnrun/track_history

John Crepezzi
@seejohnrun

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



[Rails] Re: gem and rails3: LoadError

2011-01-12 Thread Kaleem Ullah
Hey Maurice,

I think you had to use BUNDLER(in rails 3.x) as  gem dependencies for 
your application.
Here is the guide for BUNDLER(http://gembundler.com/)

cheers,

Maurice Dubois wrote in post #974263:
> Hi everybody,
>
> I'm trying to use the prawn gem into a new rails3 application on debian.
>
> What I did:
>
> As root:
>  - install rubygems, from
> http://rubyforge.org/frs/download.php/73882/rubygems-1.4.2.tgz
>  - gem install rails
>  - gem install prawn
>  - gem install pdf-reader
>  - gem list | grep prawn =>
> prawn (0.8.4)
> prawn-core (0.8.4)
> prawn-layout (0.8.4)
> prawn-security (0.8.4)
>
> As a user:
>   - rails new myapp
>   - cd myapp ; rails console =>
> 
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
> `require': no such file to load -- prawn/core (LoadError)
>
> Could somebody say what to do for prawn (or any other gem I suppose)
> being
> recognized in user's applications?
>
> Thanks
> Maurice

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



Re: [Rails] JOB: coders/developers needed for social commerce site. Board consists of public company CEOs, VC founder and NFL athlete

2011-01-12 Thread Peter Bell

On Jan 12, 2011, at 9:30 AM, Peter Hickman wrote:

> Of course saying where they are located would be a bonus :)

Well at least they didn't say "local applicants preferred" :) 

Unless it was a test - figure out where we're located or you don't have the 
initiative we want of applicants . . .

Best Wishes,
Peter


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



Re: [Rails] JOB: coders/developers needed for social commerce site. Board consists of public company CEOs, VC founder and NFL athlete

2011-01-12 Thread Peter Hickman
Yeah that really is an acronym soup he has there. I suspect that they
haven't got the faintest technical idea and so are throwing everything
including the kitchen sink into the pot. WAP, X-Windows? Hopefully
there is a damn good reason for listing these, but I suspect that
there isn't.

Of course saying where they are located would be a bonus :)

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



[Rails] auto save option in assoications

2011-01-12 Thread Prasad B.
please explain about auto save option in associations with examples

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



Re: [Rails] Re: Rails 3 + mongodb => test problems

2011-01-12 Thread Colin Law
On 12 January 2011 13:49, David White  wrote:
> It might be worth giving https://github.com/thoughtbot/factory_girl a try.
> It's an excellent alternative to fixtures and if I'm right should hopefully
> use your model which is mongo based. A good tutorial
> here: http://railscasts.com/episodes/158-factories-not-fixtures

I prefer Machinist, but it is a matter of taste.  I don't know about
using it with mongo though.

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



[Rails] Re: Rails 3 + mongodb => test problems

2011-01-12 Thread Milo Thurston
Thanks - that looks very interesting indeed. I'll give it a go.

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



[Rails] Re: Login connection between two websites

2011-01-12 Thread Fernando Perez
You can't do that accessing cookie.

You could create a button with an authentification data so that the 
other website will receive the authentification data and can login a 
user.

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



Re: [Rails] JOB: coders/developers needed for social commerce site. Board consists of public company CEOs, VC founder and NFL athlete

2011-01-12 Thread Peter Bell

On Jan 11, 2011, at 6:39 PM, Shane wrote:

> Soletron -- Job Description
> Relevant experience/languages:

Just to be really clear . . .

> Ruby on Rails, PHP programming

Because you coded in PHP to date and want to port to Ruby?

>  MVC Framework(Zend, Symfony,CakePHP)

Are you really using all three in the current code base? Given this is a Rails 
list I'm guessing you're planning to port the code to Ruby/Rails anyway ...

> CVS, SVN,

Wow - how old is the code base? Svn I get, but you have code in cvs or need to 
connect to cvs repo's? (And to mirror what most people are gonna say, go with 
git or mercurial if you have the option - very few good reasons to use svn on a 
green field app)

>  Email (Sendmail, Postfix,Qmail),

All three? And along with some of the other network stuff, considering getting 
out of that business day 1 and using something like Heroku so you can focus 
your coder on coding.

> DNS-BIND servers

Really? Unless you have a really unique app, this is commodity. You don't want 
to waste programmer time configuring, locking down and maintaining in house DNS 
servers.

> Web Services (SOAP, RPC, RSS, JSON)

The only reason for someone to know SOAP on this list is (a) so they can 
connect with painful legacy systems (I get that could be possible in retail for 
inventory) or (b) so they can be thankful they use RESTful web services and 
don't have to deal with that stuff any more. If you want to complete the usual 
annoying acronym soup, you missed XML. On a separate note, if you can find a 
programmer who can't figure out json, run very quickly in the other direction.

Best Wishes,
Peter


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



[Rails] Re: Running Spork with rspec in Rails 3 on Windows 7

2011-01-12 Thread veldtmana
Hi, Spork is running using a slightly modified version of the
0.9.0.rc2 gem

everything looks fine now... however I am not sure what to do next to
make "rake spec" use it.

I have modified the spec_helper and .rspec files

On Jan 12, 2:40 pm, Robin  wrote:
> After quite some time, I got my spork working with cygwin. what
> environment are you using and what errors do you get?
>
> On Jan 12, 3:46 am, veldtmana  wrote:
>
>
>
> > Hi,
>
> > As stated in the subject I require to set up the following:
>
> > Spork + Rspec on Windows using Rails3
>
> > It looks as if rspec is not Rails 3 ready yet and Spork does not play
> > nicely with Windows.
>
> > Is there a way to hack it all together or some viable alternative? the
> > time to run rake spec I killing me!
>
> > Any tips would be much appreciated
>
> > Regards,
>
> > Alex- Hide quoted text -
>
> - Show quoted text -

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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread David White
Could you post your projects controller? Might be able to see if there's 
something wrong in there.

David

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



[Rails] Re: Running Spork with rspec in Rails 3 on Windows 7

2011-01-12 Thread veldtmana
Sorry, typed the wrong thing:

I meant to say Spork is not rails 3 ready...

In the meantime I have managed to get Spork running on the app with
some hacks, however I am not sure how to get rspec to use it:

1) Modified spec_helper file
2) Added "-drb" to new line in .rspec file



On Jan 12, 2:09 pm, David White  wrote:
> Rspec is compatible with Rails 3.https://github.com/rspec/rspec-rails
>
> Have you looked at autotest (part of ZenTest) to save having to rake spec
> all the time. I'm sure I came across a windows Rspec, Autotest and Snarl
> notifications tutorial on the web once. A quick search will probably find
> it.
>
> David White

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



[Rails] Re: Rails 3 + mongodb => test problems

2011-01-12 Thread David White
It might be worth giving https://github.com/thoughtbot/factory_girl a try. 
It's an excellent alternative to fixtures and if I'm right should hopefully 
use your model which is mongo based. A good tutorial here: 
http://railscasts.com/episodes/158-factories-not-fixtures

David

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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread Anju P s
David White wrote in post #974269:
> Whats 1-strfronttech-011 ?
>
> If you're passing parameters in the url then you'll need to show that in
> the
> routes sometihng like.
>
> map.connect 'projects/:your_parameter/draganddropsort, :controller =>
> 'projects, :action => 'draganddropsort'
>
> You can access that parameter in your controller with
> params[:your_parameter]
>
> David

yes i did map.connect 'projects/:id/draganddropsort', :controller => 
'projects', :action => 'draganddropsort' in route.rb..

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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread David White
Whats 1-strfronttech-011 ?

If you're passing parameters in the url then you'll need to show that in the 
routes sometihng like.

map.connect 'projects/:your_parameter/draganddropsort, :controller => 
'projects, :action => 'draganddropsort'

You can access that parameter in your controller with 
params[:your_parameter]

David

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



[Rails] Re: Running Spork with rspec in Rails 3 on Windows 7

2011-01-12 Thread Robin
After quite some time, I got my spork working with cygwin. what
environment are you using and what errors do you get?

On Jan 12, 3:46 am, veldtmana  wrote:
> Hi,
>
> As stated in the subject I require to set up the following:
>
> Spork + Rspec on Windows using Rails3
>
> It looks as if rspec is not Rails 3 ready yet and Spork does not play
> nicely with Windows.
>
> Is there a way to hack it all together or some viable alternative? the
> time to run rake spec I killing me!
>
> Any tips would be much appreciated
>
> Regards,
>
> Alex

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



[Rails] Re: Rails 3 + mongodb => test problems

2011-01-12 Thread Milo Thurston
David White wrote in post #974236:
> My only suggestion now would be that fixtures is part of ActiveRecord.

It looks like you're right - thanks. Simply including fixtures.rb 
doesn't appear to work as it requires ActiveRecord::Base, which it seems 
I can't also use if sticking to those instructions. I suspect that I'll 
have to find another means to run the tests, avoiding fixtures.

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



[Rails] gem and rails3: LoadError

2011-01-12 Thread Maurice Dubois
Hi everybody,

I'm trying to use the prawn gem into a new rails3 application on debian.

What I did:

As root:
 - install rubygems, from
http://rubyforge.org/frs/download.php/73882/rubygems-1.4.2.tgz
 - gem install rails
 - gem install prawn
 - gem install pdf-reader
 - gem list | grep prawn =>
prawn (0.8.4)
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)

As a user:
  - rails new myapp
  - cd myapp ; rails console =>
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require': no such file to load -- prawn/core (LoadError)

Could somebody say what to do for prawn (or any other gem I suppose)
being
recognized in user's applications?

Thanks
Maurice

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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread Anju P s
when i tried 
'http://127.0.0.1:3000/projects/1-strfronttech-011/draganddropsort'in 
browser, i got
Unknown action

Anju

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



[Rails] Re: flash messages in locale file, what' worng?

2011-01-12 Thread Kaleem Ullah
Msan Msan wrote in post #974172:
> The controller:
> def create
>  Sector.new @ sector = (params [: sector])
>  @ sector.save
>  respond_with (@ sector)
>end
>
> in en.yml I put in the file:
>
> en:
>Flash:
>  actions:
>created:
>  notice: "ok"
>
> It seems correct but the message "ok" doesn't appears when
> successfully created a new sector.

I think you did not define flash message in your controller action.
It should be like
 def create
  ...
   if @sector.save
flash[:notice] = t('flash.actions.created.notice')
   end
  ...
 end

I have not tested it but give it a Try.

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



[Rails] read .eml files

2011-01-12 Thread Mateusz Kyc
Hi there,

I have .eml files stored in filesystem and would like to read them and
present to user. What can I use?

I tried https://github.com/mikel/mail/tree/2.2.7 but when I perform
Mail.read('filename') i get: NoMethodError: undefined method `read'
for #

Regards,
Mateusz

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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread David White
Maybe just keep it very simple with:

map.connect 'projects/draganddropsort', :controller => 'projects', :action 
=> 'draganddropsort'

And just see if you can access the draganddropsort method by navigating to 
it in your browser. Also might be worth running rake routes to see what 
routes are getting set.

David

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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread Anju P s
David White wrote in post #974243:
> The only suggestion I can think of is to check there's no private or
> protected call on any of the lines above the method name or to check the
> routes file:
>
> project_actions.connect 'projects/draganddropsort', :action
> => 'draganddropsort'
>
> Where is the project_actions coming from ? is it a block variable for
> map.resources :projects do |project_actions| ?
>
> David

 projects.with_options :conditions => {:method => :post} do 
|project_actions|

Even i think some mistake in routing ..i did some workaround on 
itbut  all in vain :(.
I call draganddropsort method from roadmap view..and its route is been 
added like

map.with_options :controller => 'projects' do |projects| 
projects.with_options :conditions => {:method => :get} do 
|project_views|
.
 project_views.connect 'projects/:id/:action', :action => 'roadmap'

end
 Can anyone suggest possible routes that i can add.

Thanks
anju

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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread David White
The only suggestion I can think of is to check there's no private or 
protected call on any of the lines above the method name or to check the 
routes file:

project_actions.connect 'projects/draganddropsort', :action 
=> 'draganddropsort'

Where is the project_actions coming from ? is it a block variable for 
map.resources :projects do |project_actions| ? 

David

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



[Rails] Re: Running Spork with rspec in Rails 3 on Windows 7

2011-01-12 Thread David White
Rspec is compatible with Rails 3. https://github.com/rspec/rspec-rails

Have you looked at autotest (part of ZenTest) to save having to rake spec 
all the time. I'm sure I came across a windows Rspec, Autotest and Snarl 
notifications tutorial on the web once. A quick search will probably find 
it.

David White

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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread Anju P s
Frederick Cheung wrote in post #974232:
> On Jan 12, 11:37am, Anju P s  wrote:
>> yes . i have same method in projects_controller.rb
>>
>
> And it's public?
>
> Fred

I hope by default its public

Anju

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



[Rails] Running Spork with rspec in Rails 3 on Windows 7

2011-01-12 Thread veldtmana
Hi,

As stated in the subject I require to set up the following:

Spork + Rspec on Windows using Rails3

It looks as if rspec is not Rails 3 ready yet and Spork does not play
nicely with Windows.

Is there a way to hack it all together or some viable alternative? the
time to run rake spec I killing me!

Any tips would be much appreciated

Regards,

Alex



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



[Rails] Re: Rails 3 + mongodb => test problems

2011-01-12 Thread David White
My only suggestion now would be that fixtures is part of ActiveRecord. If 
you're following that  tutorial then you removed the require 'rails/all' in 
favour of:

require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"

Which means you project doesn't include active record any more.


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



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread Frederick Cheung


On Jan 12, 11:37 am, Anju P s  wrote:
> yes . i have same method in projects_controller.rb
>

And it's public?

Fred
> def draganddropsort
>   .
>   end
>
> Kannav R. wrote in post #974224:
>
>
>
> > Do you have that same method in yours  projects controller  ?
>
> > On Wed, Jan 12, 2011 at 4:14 PM, Anju P s  wrote:
>
> >> <%= sortable_element 'issue-list',
> >> 2011-01-12 16:03:20) [POST]
> >> column_header, copy, current_language, current_menu_item,
> >> link_to_version, list_files, ll, logged_user=, menu_items,
> >> sort_header_tag, sort_init, sort_link, sort_name, sort_update,
> >>  /usr/lib/ruby/1.8/action_controller/rescue.rb:160:in
> >> ...
> >> --
> >> 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-t...@googlegroups.com.
> >> To unsubscribe from this group, send email to
>
> rubyonrails-talk+unsubscr...@googlegroups.com e...@googlegroups.com>
>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > --
> > Thanks:
> > Rajeev sharma
>
> --
> 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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: ActionController::UnknownAction

2011-01-12 Thread Anju P s
yes . i have same method in projects_controller.rb

def draganddropsort
  .
  end




Kannav R. wrote in post #974224:
> Do you have that same method in yours  projects controller  ?
>
> On Wed, Jan 12, 2011 at 4:14 PM, Anju P s  wrote:
>
>> <%= sortable_element 'issue-list',
>> 2011-01-12 16:03:20) [POST]
>> column_header, copy, current_language, current_menu_item,
>> link_to_version, list_files, ll, logged_user=, menu_items,
>> sort_header_tag, sort_init, sort_link, sort_name, sort_update,
>>  /usr/lib/ruby/1.8/action_controller/rescue.rb:160:in
>> ...
>> --
>> 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-t...@googlegroups.com.
>> To unsubscribe from this group, send email to
>>
> 
rubyonrails-talk+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
>
>
> --
> Thanks:
> Rajeev sharma

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



[Rails] Re: Rails 3 + mongodb => test problems

2011-01-12 Thread Milo Thurston
David White wrote in post #974225:
> Have you tried adding the fixtures :all inside the JobsControllerTest
> class?

I did - sorry, should have mentioned it. That produces the same effect 
as putting it in test_helper.rb, ie.

undefined method `fixtures' for JobsControllerTest:Class (NoMethodError)

Checking back to my Rails 2 code I used to have fixtures :all in the 
test_helper, so perhaps something is missing as a result of using 
MongoDB.

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



Re: [Rails] has_many :through=>one

2011-01-12 Thread Michael Pavling
On 12 January 2011 10:44, Colin Law  wrote:
> However I don't think your use of the word
> denormalise is correct.

yeah... wrong term... sorry for any confusion. Encapsulation and
separation of responsibility is more the gist of why I'd keep the User
and Profile stuff apart. All personal preference and project
requirements decisions though...

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



  1   2   >