[Rails] Re: NoMethodError: undefined method `expenses'

2009-01-28 Thread Eric

UMQ: Use More Quotes!

:vendor => "vendor1", :amount => "75.00"

On Jan 28, 9:22 pm, Andrew Reid 
wrote:
> Hi,
> I am trying to figure out why I am receiving the following error.  I am
> following an Apple Developers Rail Application tutorial.
>
> >> event.expenses.create(:vendor => vendor1, :amount =>75.00)
>
> NameError: undefined local variable or method `vendor1' for
> #
>   from (irb):2
>
> Here is what I have for the models
>
> class Event < ActiveRecord::Base
>   validates_presence_of :name
>   validates_numericality_of :budget, :greater_than => 0.0
>
>   has_many :expenses
>   has_many :vendors, :through => :expenses
> end
>
> ___
>
> class Expense < ActiveRecord::Base
>   belongs_to :event
>   belongs_to :vendor
> end
>
> ___
>
> class Vendor < ActiveRecord::Base
>   has_many :expenses
>   has_many :events, :through => :expenses
> end
>
> I read another post where they had issues with Xcode not saving and
> having to restart terminal.  I have done both and everything looks
> right.
> Thanks in advance for any help!
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Back button works even after logout - How to prevent?

2009-01-28 Thread Ar Chron

You can add a before_filter to your controllers to ensure that the user 
is logged in.

I use restful authentication (that provides the login_required method), 
and I let anyone see the index listing of a table, or a show of any 
individual record, but create, update, new, delete, etc, are all locked 
behind a logged in session.

before_filter :login_required, :except => [:index, :show]
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Back button works even after logout - How to prevent?

2009-01-28 Thread Tony Puthenveettil

Hi all,
In my web application, after logging out, if Back button of the browser
is clicked, it takes to the previous logged in pages and allows all
operations without logging in. The layout, however, doesn't change, but
the yield pages.

Please help me prevent that back button operation after logout. Given
below is my logout controller.
#Controller
  def logout
if session[:admin] || session[:user]
  reset_session
  flash[:notice] = 'Logged out successfully'
  redirect_to :controller => 'homes', :action => 'index'
else
  flash[:error] = 'Not logged in'
end
  end

Your prompt response 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-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] NoMethodError: undefined method `expenses'

2009-01-28 Thread Andrew Reid

Hi,
I am trying to figure out why I am receiving the following error.  I am
following an Apple Developers Rail Application tutorial.

>> event.expenses.create(:vendor => vendor1, :amount =>75.00)
NameError: undefined local variable or method `vendor1' for
#
  from (irb):2


Here is what I have for the models


class Event < ActiveRecord::Base
  validates_presence_of :name
  validates_numericality_of :budget, :greater_than => 0.0

  has_many :expenses
  has_many :vendors, :through => :expenses
end


___

class Expense < ActiveRecord::Base
  belongs_to :event
  belongs_to :vendor
end

___

class Vendor < ActiveRecord::Base
  has_many :expenses
  has_many :events, :through => :expenses
end


I read another post where they had issues with Xcode not saving and
having to restart terminal.  I have done both and everything looks
right.
Thanks in advance for any help!
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Best practices for develop a web service (server+client)

2009-01-28 Thread Jay Mcgratgh

remotely related ...

Can Rails on Ruby work with an established sqlite3 (or mySQL) database? 
the tutorials I have read so far build the sqlite3 tables with the $ 
"ruby script/generate model ... " command.

I guess what I am trying to figure out is if the Ruby Rails platform 
will be a wise investment of my time to learn and eventually become 
proficient if my goal is to build some web applications that interact to 
already established databases.

I would prefer to build my database the old fashioned way - e.g., SQL 
CREATE statements - and be able to modify the structure on the fly 
(structure and data).  The web pages would be a simple GUI interface for 
my computer challenged friends! :)
I am hopeful that the Rails on Ruby will allow that flexibility? 
Eventually, I suspect that I will be good enough to do it all in Rails 
like you all do.

Advice?

thanks in advance

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

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



[Rails] Re: Any one help

2009-01-28 Thread Shankar Ganesh

Is it possible to get using cycle method??


Rob Zolkos wrote:
> Hi Shankar,
> 
> Have a look at the api documentation for the cycle method
> 
> http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001551
> 
> Thanks,
> Rob

-- 
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] Removing an association from a derived class

2009-01-28 Thread pankaj

I am using single table inheritance.

class User < ActiveRecord::Base
  has_many :abc
end

class Student < User

end

The student class should not inherit the has_many :abc relationship.
How can we override it? Is there a way to remove an association in the
derived class?

Pankaj


--~--~-~--~~~---~--~~
You received 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: Any one help

2009-01-28 Thread robokos

Hi Shankar,

Have a look at the api documentation for the cycle method

http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001551

Thanks,
Rob

Shankar Ganesh wrote:
> ---
> id | what   | when  | color  |   to  | description |
> ---
> 1  | test   |01/01/2009 | red|04/01/2009 | hi this is test |
> ---
> 2  | test2  |02/01/2009 | green  |04/01/2009 | hi this is test |
> ---
> 3  | test3  |01/01/2009 | blue   |04/01/2009 | hi this is test |
> ---
> 4  | test4  |02/01/2009 | orange |04/01/2009 | hi this is test |
> ---
>
> I WANT TO HAVE OUTPUT LIKE THIS.,
>
> 20090101 "test style="color:blue">test3"
> 20090102 "test2 style="color:red">testtest3 style="color:orange">test4"
> 20090103 "test2 style="color:red">testtest3 style="color:orange">test4"
> 20090104 "test2 style="color:red">testtest3 style="color:orange">test4"
>
> Thanks in Advance
> --
> Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: javascript function needs rails variable

2009-01-28 Thread Rabia Akhtar
it starts working
Cheers
Rabia Akhtar

On Wed, Jan 28, 2009 at 8:41 PM, jemminger  wrote:

>
> This will only work if that script block is in an .erb template.
>
> On Jan 28, 1:02 am, Rabia  wrote:
> > 
> >
> > document.getElementById('h').checked=true;
> > show_coords(<%= @pic_comments.to_json %>,"main",'<%=$domain%>/
> > users/update_picture_div',<%= @picture.id %>)
> >
> >  
> > I have implement this but rails variables are not working.
> >
>

--~--~-~--~~~---~--~~
You received 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] Any one help

2009-01-28 Thread Shankar Ganesh

---
id | what   | when  | color  |   to  | description |
---
1  | test   |01/01/2009 | red|04/01/2009 | hi this is test |
---
2  | test2  |02/01/2009 | green  |04/01/2009 | hi this is test |
---
3  | test3  |01/01/2009 | blue   |04/01/2009 | hi this is test |
---
4  | test4  |02/01/2009 | orange |04/01/2009 | hi this is test |
---

I WANT TO HAVE OUTPUT LIKE THIS.,

20090101 "testtest3"
20090102 "test2testtest3test4"
20090103 "test2testtest3test4"
20090104 "test2testtest3test4"

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

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



[Rails] Re: Rails runtime

2009-01-28 Thread Mark Reginald James

Camille Roux wrote:

> I've a question about the Rails runtime.
> I'd like to know which part of Rails is executed (and put in memory) at
> each request? at each server launch?
> In other words, is Rails like PHP (the whole code is "executed" at each
> request)?

On on start-up in production mode a Rails app will load, execute,
and cache the Rails framework plus certain parts of the app code.
The rest of the app code is loaded and cached on-demand when an
unknown class or module is referenced during a request.

-- 
Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.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: Plugin Module Help

2009-01-28 Thread Mark Reginald James

Nate Leavitt wrote:

> Is the thread specific for the request in rails? Meaning.. the 
> before_filter will be run on each rails action/request therefore is a 
> new thread created in rails for that process?  Jeez.. I hope I'm 
> explaining it properly :)

Yes, each thread only carries one request at time.

> Also, since that before filter is creating a new AppConn obj do I have 
> to worry about performance?  It just seems that creating a new AppConn 
> for each rails request seems like overkill.  Am I wrong in thinking 
> that?

Creating such a small AppConn object with each request shouldn't
be a problem.

If it is you can instead do

def self.set_account(url, key)
  if ac = Thread.current[:api_conn]
ac.url, ac.key = url, key
  else
Thread.current[:api_conn] = ApiConn.new(url, key)
  end
end

-- 
Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.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] CGI Sessions

2009-01-28 Thread doug

I have several Rails sites running that use sessions and they all post
cookies properly and otherwise work flawlessly.  I now have need of
implementing a more raw approach to sessions using CGI::Sessions.

The Pickaxe book gives an example of how to do it (which I will append
to this message) after which they make the following statement:

This will send a cookie to the user named ``rubyweb'' with a value of
9650. It will also create a disk file in $TMP/web-session.9650 with
the key, value pairs for CustID and Part.

Upon trying the example, I first notice that the disk file is not
named 'session.9650'.  That's not a big deal.  However, of more
importance is the fact that it fails to plant a cookie in my browser.
Apparently, this failure prevents it from knowing that a session has
been established; so, it opens a new session with each access.

Because my Rails installations do sessions so well, I conclude that
the Rails community must know something about getting this to work
that I don't.  I'm hopeful that someone here can point out the error
of my ways and I hope that my post will not be considered too far off
topic.  If anyone can help me, I would deeply appreciate it.  Thanks.

   ... doug

P.S. -- Pickaxe Example:

<% require "cgi"
   require "cgi/session"
   cgi = CGI.new("html3")
   sess = CGI::Session.new( cgi, "session_key" => "rubyweb",
"session_id"  => "9650",
"new_session" => true,
"prefix" => "web-session.")
sess["CustID"] = 123
sess["Part"] = "ABC" %>

--~--~-~--~~~---~--~~
You received 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: Mysql::Error: Duplicate entry

2009-01-28 Thread Frederick Cheung


On 28 Jan 2009, at 21:14, Rt Rr wrote:

>
>
> hello , I am designing a project for a  news website and I am new to  
> ROR
> I am facing a problem with the add news function
>
> this is the error
>
> Mysql::Error: Duplicate entry '' for key 1: INSERT INTO `articals`
> (`body`, `title`, `date`, `tag`) VALUES('nnn', 'hhh',  
> '2008-03-02',
> '')
>
sounds like you've got a unique index somewhere.

Fred


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



[Rails] Net:HTTP.post returns an Array

2009-01-28 Thread David Law

I was wondering if anyone has run into this problem.  I post using a
Net::HTTP object and instead of getting Net::HTTPResponse object, the
server returns an Array causing an error since an we typically attempt
to read the body of the Net::HTTPResponse object.  Does anyone know
why this is occurring?  Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: :active_record_store + :table_name_with_underscore session issues

2009-01-28 Thread Frederick Cheung


On 29 Jan 2009, at 00:26, Tim wrote:

>>
>> When I look in the sessions table the hashed data in the `data` field
>> looks normal, but there are integers being stored in the session_id
>> field, not the 32 character hashes I would expect.  And every page
>> reload creates a new session, the integer stored in the session_id
>> field is incremented by one.  I'm thinking session data is being
>> written, but then cannot be retrieved.
>>

Hmm. The problem you have is that by setting primary key  
to :table_name_with_underscore rails wants to use session_id as the  
primary key to the sessions table. it also wants to use session_id for  
the session identifier and for whatever reason, the primary key 'wins'.
You could fiddle the SessionClass for it to store the session  
identifier in a different column (or  
CGI::Session::ActiveRecordStore::Session.set_primary_key 'id' would  
probably do the trick if you can get away with it.

Fred


>> I've tried a number of things I found searching, such as:
>>
>> CGI::Session::ActiveRecordStore::Session.set_primary_key 'session_id'
>>
>> none of which help.  Any idea what I need to do?
>>
>> I have other, older Rails apps using active_record_store sessions  
>> that
>> work just fine, but this is my first one on Rails 2.2.2 and so far
>> it's a no-go.
>>
>> --
>> Greg Donaldhttp://destiney.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: :active_record_store + :table_name_with_underscore session issues

2009-01-28 Thread Tim

You may want to browse:

http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html

and

http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html

Good luck!
Tim

On Jan 28, 1:24 pm, Greg Donald  wrote:
> Today I created a new Rails 2.2.2 project.
>
> I'm using Oracle and activerecord-oracle-adapter (1.0.0.9250).
>
> I'm using ActiveRecord::Base.primary_key_prefix_type =
> :table_name_with_underscore, which is a spec for the project that I
> cannot change.
>
> I ran `rake db:sessions:create` and it created a new migration that
> looks like this:
>
> class CreateSessions < ActiveRecord::Migration
>
>   def self.up
>     create_table :sessions do |t|
>       t.string :session_id, :null => false
>       t.text :data
>       t.timestamps
>     end
>     add_index :sessions, :session_id
>     add_index :sessions, :updated_at
>   end
>
>   def self.down
>     drop_table :sessions
>   end
>
> end
>
> This does not work.  I get the error:
> ActionController::InvalidAuthenticityToken on any forms that are
> posted.
>
> When I look in the sessions table the hashed data in the `data` field
> looks normal, but there are integers being stored in the session_id
> field, not the 32 character hashes I would expect.  And every page
> reload creates a new session, the integer stored in the session_id
> field is incremented by one.  I'm thinking session data is being
> written, but then cannot be retrieved.
>
> I've tried a number of things I found searching, such as:
>
> CGI::Session::ActiveRecordStore::Session.set_primary_key 'session_id'
>
> none of which help.  Any idea what I need to do?
>
> I have other, older Rails apps using active_record_store sessions that
> work just fine, but this is my first one on Rails 2.2.2 and so far
> it's a no-go.
>
> --
> Greg Donaldhttp://destiney.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: format.html and redirect_to

2009-01-28 Thread Frederick Cheung


On 28 Jan 2009, at 23:42, Ricky wrote:

>
>> It might not be a browser. Eg with a create action you would  
>> typically
>> redirect browsers to the show action, but the XML api probably
>> wouldn't do that.
>
> Thanks for responding Fred.
>
> So are you saying that sometimes a redirect is not actually a redirect
> in the 302 sense of the word? Rather that, sometimes, a redirect
> *does* result in actual content being sent back to the browser/AJAX
> component?
>
A redirect is always a redirect. What i'm saying is that sometimes you  
don't want to redirect, in the aforementioned xml api example you'd  
probably just respond with an empty response with the appropriate http  
status code. An ajaxified interface is also a place where you might  
not want to do a redirect (you'd just return some html to be inserted  
into the DOM or produce some javascript to execute).

Fred

> Rick
> >


--~--~-~--~~~---~--~~
You received 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: Can I "fake" an object model on top of a flat ActiveReco

2009-01-28 Thread Duane Morin

You know, that might be exactly it.  I knew I'd heard it somewhere 
before :).

Thanks!  Sorry for the interruption.

D
Duane Morin wrote:
> This might be a painfully bad idea, but it's gotten me curious.  I have
> a generic object Node, which has a name attribute.  Say for example that
> one of the names is "Widget".
> 
> What I'm wondering is, is there a way to manipulate ActiveRecord to make
> a class  named Widget, that behaves exactly like a Node with the only
> difference being that all operations only work on the condition
> (name="Widget") is true?  I can do a simpleclass Widget < Node   to
> get it started, but I'm looking for what the next line would be, where I
> can specify the global condition.  In all other cases,
> 
> History : The database itself is generated rather, well, generically by
> scanning a file where I don't know the nature of the content beyond
> simple node relationships (i.e. I don't know ahead of time all values
> for "name").  However, I'm thinking that after the flat data storage
> portion is taken care of I could go in and maybe write some sort of
> generator for myself that would build up the Ruby classes to deal with
> the database, and hide the whole thing.

-- 
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: Can I "fake" an object model on top of a flat ActiveRecord?

2009-01-28 Thread Tim

I'm not completely clear on what your trying to accomplish but it
sounds like STI may be what your looking for?

http://wiki.rubyonrails.org/rails/pages/singletableinheritance

Good luck!
Tim

On Jan 28, 3:40 pm, Duane Morin 
wrote:
> This might be a painfully bad idea, but it's gotten me curious.  I have
> a generic object Node, which has a name attribute.  Say for example that
> one of the names is "Widget".
>
> What I'm wondering is, is there a way to manipulate ActiveRecord to make
> a class  named Widget, that behaves exactly like a Node with the only
> difference being that all operations only work on the condition
> (name="Widget") is true?  I can do a simple    class Widget < Node   to
> get it started, but I'm looking for what the next line would be, where I
> can specify the global condition.  In all other cases,
>
> History : The database itself is generated rather, well, generically by
> scanning a file where I don't know the nature of the content beyond
> simple node relationships (i.e. I don't know ahead of time all values
> for "name").  However, I'm thinking that after the flat data storage
> portion is taken care of I could go in and maybe write some sort of
> generator for myself that would build up the Ruby classes to deal with
> the database, and hide the whole thing.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: format.html and redirect_to

2009-01-28 Thread Ricky

> It might not be a browser. Eg with a create action you would typically  
> redirect browsers to the show action, but the XML api probably  
> wouldn't do that.

Thanks for responding Fred.

So are you saying that sometimes a redirect is not actually a redirect
in the 302 sense of the word? Rather that, sometimes, a redirect
*does* result in actual content being sent back to the browser/AJAX
component?

Rick
--~--~-~--~~~---~--~~
You received 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] Can I "fake" an object model on top of a flat ActiveRecord?

2009-01-28 Thread Duane Morin

This might be a painfully bad idea, but it's gotten me curious.  I have
a generic object Node, which has a name attribute.  Say for example that
one of the names is "Widget".

What I'm wondering is, is there a way to manipulate ActiveRecord to make
a class  named Widget, that behaves exactly like a Node with the only
difference being that all operations only work on the condition
(name="Widget") is true?  I can do a simpleclass Widget < Node   to
get it started, but I'm looking for what the next line would be, where I
can specify the global condition.  In all other cases,

History : The database itself is generated rather, well, generically by
scanning a file where I don't know the nature of the content beyond
simple node relationships (i.e. I don't know ahead of time all values
for "name").  However, I'm thinking that after the flat data storage
portion is taken care of I could go in and maybe write some sort of
generator for myself that would build up the Ruby classes to deal with
the database, and hide the whole thing.
-- 
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: xml_http_request : action not found?

2009-01-28 Thread itsastickup

Ok, so the solution seems to be to forget paths and do the test like
this :

xml_http_request :delete,'destroy',{:id=>1,:person_id=>1}
--~--~-~--~~~---~--~~
You received 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: Best practices for develop a web service (server+client)?

2009-01-28 Thread Xdmx Xdmx

Freddy Andersen wrote:
> What about activeResource ?

You mean activeresource for the rest approach ? for that sure, but you'd 
always have the client who request a given url and get some xml to 
parse... right?

Which is the better format to give the client between xml and json ?
And how to parse back from xml/json to a an object to include in the db? 
Just a simple loop over all the data and a Model.create(..) for 
each?


Nate Leavitt wrote:
> If the apps aren't rails specific, I would suggest to write a simple 
> rack application.  It's actually pretty useful when interfacing API's 
> that are non-rails.

both are rails apps
-- 
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: Database names

2009-01-28 Thread Luke Pearce

James Bond wrote:
> If I generate a model by: "./script generate model user" it make a table
> "users".
> But if I want that table is "user" not "users" what I can do?

Think this is what you're looking for:

http://wiki.rubyonrails.org/rails/pages/howtouselegacyschemas

Cheers
Luke
-- 
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: Database names

2009-01-28 Thread Robert Walker

James Bond wrote:
> If I generate a model by: "./script generate model user" it make a table
> "users".
> But if I want that table is "user" not "users" what I can do?

You can override the default table name in your migration file after 
running the generator.

However, if I had anything to say about it I would not allow a developer 
to break this Rails convention. The only allowable exception would be in 
the case of a pre-existing database schema that is being used somewhere 
outside the Rails project.

But, if you want to go to all the extra trouble to break with 
convention, Rails will certainly let you do so.

You need to change the table name in the migration and also set the 
table name in the model so it knows what to look for:

Example:
---
class Project < ActiveRecord::Base
  set_table_name "project"
end

class CreateProjects < ActiveRecord::Migration
  def self.up
create_table :project do |t| # Note singular form
  t.string :name
  t.text :description

  t.timestamps
end
  end

  def self.down
drop_table :project # And here too
  end
end

-- 
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: Best find for the job...

2009-01-28 Thread Robert Walker

Neal L wrote:
> What I'm trying to do is find the total charges during the year for
> each customer by account.  In other words, a function like:

I'm guessing that the most efficient way to accomplish this (that is 
without doing some data caching), would be to let the database handle 
it.

If you had a database view configured something like this:
---
customer_charges (DB View)
---
select t0.customer_name, sum(t1.amount) as amount
  from customers t0 join charges t1 on t0.id=t1.customer_id
  group by t0.id, t1.account_id
  having year(t1.created_at)=year(current_date());
---
Then you could create a model that manages this report data:

CustomerCharge << ActiveRecord::Base
  def readonly?
true
  end
end

Note: This is all written off of top of my head with absolutely not 
tested.

Another option might be to create a class in Ruby that mimics a database 
view by executing some raw SQL.
-- 
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: xml_http_request : action not found?

2009-01-28 Thread itsastickup

> > I have this in a functional test:
>
> > xml_http_request :delete, person_movie_path(1,1)
>
> > and the error I get says the action cannot be found, as if the
> > ':delete'  method is not being translated to the appropriate destroy
> > action. It works fine as an Ajax call from the browser.
>
> Probably wrong path.  Check the URL generated by "person_movie_path(1,1)"
> against the output of "rake routes".

That's what I thought but it checks out fine (I've practically blinded
myself examining rake routes). I even test the route in the test
method, and it passes. And it does work from the browser: indentical
path (and :delete method).

The error I get is :

ActionController::UnknownAction: No action responded to /people/1/
movies/1. Actions: create, create_guid, lots more methods here,
including "destroy"


--~--~-~--~~~---~--~~
You received 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] :active_record_store + :table_name_with_underscore session issues

2009-01-28 Thread Greg Donald

Today I created a new Rails 2.2.2 project.

I'm using Oracle and activerecord-oracle-adapter (1.0.0.9250).

I'm using ActiveRecord::Base.primary_key_prefix_type =
:table_name_with_underscore, which is a spec for the project that I
cannot change.

I ran `rake db:sessions:create` and it created a new migration that
looks like this:

class CreateSessions < ActiveRecord::Migration

  def self.up
create_table :sessions do |t|
  t.string :session_id, :null => false
  t.text :data
  t.timestamps
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
  end

  def self.down
drop_table :sessions
  end

end

This does not work.  I get the error:
ActionController::InvalidAuthenticityToken on any forms that are
posted.

When I look in the sessions table the hashed data in the `data` field
looks normal, but there are integers being stored in the session_id
field, not the 32 character hashes I would expect.  And every page
reload creates a new session, the integer stored in the session_id
field is incremented by one.  I'm thinking session data is being
written, but then cannot be retrieved.

I've tried a number of things I found searching, such as:

CGI::Session::ActiveRecordStore::Session.set_primary_key 'session_id'

none of which help.  Any idea what I need to do?

I have other, older Rails apps using active_record_store sessions that
work just fine, but this is my first one on Rails 2.2.2 and so far
it's a no-go.




-- 
Greg Donald
http://destiney.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: xml_http_request : action not found?

2009-01-28 Thread Jeffrey L. Taylor

Quoting itsastickup :
> 
> 
> I have this in a functional test:
> 
> xml_http_request :delete, person_movie_path(1,1)
> 
> and the error I get says the action cannot be found, as if the
> ':delete'  method is not being translated to the appropriate destroy
> action. It works fine as an Ajax call from the browser.
> 

Probably wrong path.  Check the URL generated by "person_movie_path(1,1)"
against the output of "rake routes".

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-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] Mysql::Error: Duplicate entry

2009-01-28 Thread Rt Rr


hello , I am designing a project for a  news website and I am new to ROR
I am facing a problem with the add news function

this is the error

Mysql::Error: Duplicate entry '' for key 1: INSERT INTO `articals`
(`body`, `title`, `date`, `tag`) VALUES('nnn', 'hhh', '2008-03-02',
'')

-
this is my code

class ArticleController < ApplicationController

def new

@article = Article.new
@article.date = Date.today
end

def create
@article = Article.new(params[:article])
if @article.save
redirect_to :action => 'list'
else
render :action => 'new'
end
 end

--
add.rhtml in views

Add new article
<% form_tag :action => 'create' do %>
Title:
<%= text_field 'article', 'title' %>
Body:

<%= text_area 'article', 'body' %>

Date:
<%= text_field 'article', 'date' %>

Tag:
<%= text_field 'article', 'tag' %>

<%= submit_tag "Create" %>
<% end %>
<%= link_to 'Back', {:action => 'list'} %>
 --

please help :(
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Restful routes and Rails Console

2009-01-28 Thread Bharat Ruparel

Thank you Steve.  This is precisely what I needed.
Thomas, I appreciate your time as well.  It is just that I learn better 
by typing "things" in the Rails Console in bits and pieces and see what 
happens.  It is this interactive nature of Ruby and Rails which I like 
very much.  Reminds me of the "Immediate Window" in Visual Basic/Access 
which made me very productive.

But I do agree with both you gentlemen that a structured testing 
methodology is better suited for the task.

Regards,

Bharat
-- 
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] Database names

2009-01-28 Thread James Bond

If I generate a model by: "./script generate model user" it make a table
"users".
But if I want that table is "user" not "users" what I can do?
-- 
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] JOBS-Ruby on Rails Developer position OPEN in Atlanta!!

2009-01-28 Thread mcf...@gmail.com

Client in Atlanta is looking for a Mid-Level Ruby on Rails Developer.
Open to relocation.  Check out job the description below.  If you are
interested please email resumes to m...@thecentricsgroup.com and I
will contact you shortly after.

Description:

Client is looking for a Ruby on Rails Developer to help us support and
grow our web presence.

The Ruby on Rails Developer will be contributing as a valuable member
of the IT/E-commerce Department to develop and maintain retail
websites.

This position reports to the Senior Ruby on Rails Developer.

Required Skills:

• Minimum 3 years experience developing software in a professional e-
commerce environment.
• Full knowledge of HTTP and standard web software architecture.
• Fluent in Ruby, PHP, Perl, DHTML and CSS.
• Ability to work in a small, dynamic programming team with numerous
responsibilities; Excellent code troubleshooting and testing skills.
• A willingness to learn and commitment to quality.
• Contribute to a seasoned web development team to build best in class
e-commerce websites.
• Analyze technical specification requirement documents and develop
code in adherence and conformance with approved development
methodologies.
• Develop additional features for web based applications including
front-end development, server-side development and database
integration.
• Analyze and identify additional areas of improvement in the current
websites.
• Develop high quality code to effective implement strategies to
enhance customer experience on the website.
• Work as part of a multi-discipline team to create successful online
solutions.

Desired Skills:

• Familiarity with relational databases is a plus (MySQL etc.)
• Experience with JavaScript and Linux server knowledge is helpful.

Qualifications (Education, Experience, and Certifications)

• Bachelor's degree is preferred, particularly in computer sciences.
Professional web development experience is a must – you must be able
to hit the ground running. Strong real-world experience is more than a
substitute for your degree, however.
• Proven results oriented person with a delivery focus - especially in
the areas of writing high-performance, reliable and maintainable
code.
• Ability to adapt to new development environments, changing business
requirements and learning new systems highly desired.
• Deep understanding of web services software architectural and design
issues.
• Experience with order processing systems.
• Works well with a cross functional team.

Other Skills:

• Must have positive work attitude, be a team player, be results
oriented, be a fast learner and be able to accept change.
• This position pays a base salary commensurate with experience plus a
full package of benefits.




--~--~-~--~~~---~--~~
You received 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: Creating an object from a pp string?

2009-01-28 Thread Yanni Mac

Yanni Mac wrote:
> Here is the full implementation in case anyone is interested.
> 
> Server 2 needs to get a widget object from server 1
> 
> 
> Server 1 code
> --
> WidgetController
> def show_widget_yaml
>   @widget = Widget.find(params[:id])
>   render  :layout =>  false
> end
> 
> show_widget_yaml.rhtml
> <%=YAML.dump(@product)%>
> 
> 
> 
> Server 2 code
> 
> def show
>   client = HTTPClient.new
>   response = 
> client.get('http://www.server1/widgets/show_widget_yaml'+params[:id])
>   yaml_string = response.body.content
>   @product = Product.new
>   @product = YAML.load(yaml_string)
> end


Correction..  I forgot to replace some variable names from my own code


Server 1 code
-
 WidgetController
 def show_widget_yaml
   @widget = Widget.find(params[:id])
   render  :layout =>  false
 end

 show_widget_yaml.rhtml
 <%=YAML.dump(@widget)%>



 Server 2 code
 
 def show
   client = HTTPClient.new
   response =
 client.get('http://www.server1/widgets/show_widget_yaml'+params[:id])
   yaml_string = response.body.content
   @widget = Widget.new
   @widget = YAML.load(yaml_string)
 end


-- 
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] xml_http_request : action not found?

2009-01-28 Thread itsastickup


I have this in a functional test:

xml_http_request :delete, person_movie_path(1,1)

and the error I get says the action cannot be found, as if the
':delete'  method is not being translated to the appropriate destroy
action. It works fine as an Ajax call from the browser.

What am I doing wrong?
--~--~-~--~~~---~--~~
You received 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: Plugin Module Help

2009-01-28 Thread Nate Leavitt

Mark Reginald James wrote:

> Yes.


Is the thread specific for the request in rails? Meaning.. the 
before_filter will be run on each rails action/request therefore is a 
new thread created in rails for that process?  Jeez.. I hope I'm 
explaining it properly :)

Also, since that before filter is creating a new AppConn obj do I have 
to worry about performance?  It just seems that creating a new AppConn 
for each rails request seems like overkill.  Am I wrong in thinking 
that?

Thanks again for your responses.

-- 
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: Creating an object from a pp string?

2009-01-28 Thread Yanni Mac

Here is the full implementation in case anyone is interested.

Server 2 needs to get a widget object from server 1


Server 1 code
--
WidgetController
def show_widget_yaml
  @widget = Widget.find(params[:id])
  render  :layout =>  false
end

show_widget_yaml.rhtml
<%=YAML.dump(@product)%>



Server 2 code

def show
  client = HTTPClient.new
  response = 
client.get('http://www.server1/widgets/show_widget_yaml'+params[:id])
  yaml_string = response.body.content
  @product = Product.new
  @product = YAML.load(yaml_string)
end
-- 
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: User Interface / View Looks

2009-01-28 Thread sullivan.t

:) I know, I know.

I guess what I've done is hit that "wall" where I know my visual
creativity sucks, and I need that polishing to refresh that old-
fashioned "inner" desire to code my own on the side.  Can't do it like
I used to, 15 years ago.  By the time I get home, I'm exhausted from
coding at "work" all day. :P

On Jan 28, 2:00 pm, Robby Russell  wrote:
> On Wed, Jan 28, 2009 at 10:13 AM, sullivan.t  wrote:
>
> > What are people doing these days for the "user interface" side of
> > applications?  I'm in the process of writing something, using a lot of
> > CSS (good) but I keep getting the feel that this application ("rts")
> > would be better shown to the world in a flash format on the view end.
> > Thoughts? Adobe AIR?  Laszlo?
>
> XHTML/CSS only requires on client-side plugin... a web browser. ;-)
>
> Robby
>
> --
> Robby Russell
> Chief Evangelist, Partner
>
> PLANET ARGON, LLC
> design // development // hosting w/Ruby on Rails
>
> http://www.planetargon.com/http://www.robbyonrails.com/
> aim: planetargon
>
> +1 503 445 2457
> +1 877 55 ARGON [toll free]
> +1 815 642 4068 [fax]
--~--~-~--~~~---~--~~
You received 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: Best practices for develop a web service (server+client)?

2009-01-28 Thread Nate Leavitt

Xdmx Xdmx wrote:
> Hi, i've two applications (APP1 and APP2) and i want that APP2 is able
> to get data from APP1. I think that a simple rest web service is the way
> to go. Do you have some good examples/tutorials? I've googled but i find
> only old examples with the deprecated action web service. From the
> client, who get the xml, how does reconvert it into ruby/model objects?

If the apps aren't rails specific, I would suggest to write a simple 
rack application.  It's actually pretty useful when interfacing API's 
that are non-rails.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Restful routes and Rails Console

2009-01-28 Thread s.ross
Hi--
On Jan 28, 2009, at 10:44 AM, Thomas R. Koll wrote:

>
> Hi,
>
> On Jan 28, 5:10 pm, Bharat Ruparel wrote:
>
>> I am trying to see what comments_url resolves to in the Rails  
>> Console,
>> but do not know how.
>
> There's a good reason for this: You don't use/need urls in your
> console.
> The best way is to write tests for your routes, this will also give
> you the
> most confidence in your own code.

If you want to test routes, shoulda[1] has macros for that. For rspec  
users, that would be carlosbrando-remarkable[2].

If you still want to puch this stuff into console,

 >> include ActionController::UrlWriter
 >> new_session_path
=> "/session/new"

See if this helps.

[1] Projects - Shoulda
[2] carlosbrando's remarkable at master - GitHub
--~--~-~--~~~---~--~~
You received 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: Plugin Module Help

2009-01-28 Thread Nate Leavitt

Mark Reginald James wrote:
> Nate Leavitt wrote:
> 
>> Is that multi-thread safe for the newer versions of rails?
> 
> Yes.
> 
> --
> Rails Wheels - Find Plugins, List & Sell Plugins - 
> http://railswheels.com

Ok thanks.  I guess my next question is more in regards to threads, but 
if I have multiple accounts logged in how do the threads stay specific 
for each account?

Looks like I need to read up on threads.
-- 
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: Creating an object from a pp string?

2009-01-28 Thread Yanni Mac

Philip Hallstrom wrote:
>> Right now I am just creating a pipe-delimited string of the object
>> attributes.  Then the other server takes that string, splits it on |  
>> and
>> populates a new object.  Really I am just wondering if there is a one
>> liner from a library where I can do this.  JSON, etc.. would be
>> overkill, since I can easily do it with a pipe-delimited string.  I
>> might just code a utility to do this with the pp string unless someone
>> has some code that already does this.  let me know..  thank
> 
> http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/classes/YAML.html#M010508
> http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/classes/YAML.html#M010509

Ah..  you da man.  Thanks, I guess I overlooked that ;-)  That does 
exactly what I need it to.
-- 
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: Creating an object from a pp string?

2009-01-28 Thread Philip Hallstrom

>>
>> If you really want to go that route you might look at converting it  
>> to
>> YAML... but I'd also suggest looking at JSON, XML, XML-RPC, REST,
>> active resource, etc...
>>
>> -philip
>
> Thanks for the quick reply!
>
> Right now I am just creating a pipe-delimited string of the object
> attributes.  Then the other server takes that string, splits it on |  
> and
> populates a new object.  Really I am just wondering if there is a one
> liner from a library where I can do this.  JSON, etc.. would be
> overkill, since I can easily do it with a pipe-delimited string.  I
> might just code a utility to do this with the pp string unless someone
> has some code that already does this.  let me know..  thank

http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/classes/YAML.html#M010508
http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/classes/YAML.html#M010509


--~--~-~--~~~---~--~~
You received 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: Creating an object from a pp string?

2009-01-28 Thread Yanni Mac

Philip Hallstrom wrote:

> 
> If you really want to go that route you might look at converting it to
> YAML... but I'd also suggest looking at JSON, XML, XML-RPC, REST,
> active resource, etc...
> 
> -philip

Thanks for the quick reply!

Right now I am just creating a pipe-delimited string of the object 
attributes.  Then the other server takes that string, splits it on | and 
populates a new object.  Really I am just wondering if there is a one 
liner from a library where I can do this.  JSON, etc.. would be 
overkill, since I can easily do it with a pipe-delimited string.  I 
might just code a utility to do this with the pp string unless someone 
has some code that already does this.  let me know..  thanks
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Multi table inheritance problem with has_one relationship

2009-01-28 Thread Rémi Gagnon

Thanks Tom for the suggestion.  I did not know this.  But the bads new 
is that does the same issue.

It looks like the superclass name is cached in the association then even 
if I do a reload or (true) and becomes, it fetch the data from Product 
instead of ProductVT

Rémi


Thomas r. Koll wrote:
> Hi,
> 
> On Jan 27, 7:46�pm, R�mi Gagnon 
> wrote:
> 
>> TransactionProduct.find(:first).product.relaod �(reload the product
>> instance instead of ProductVT)
>>
>> Even if I see in the console that is a ProductVT it reloads Product. �I
>> checked in development.log and in performs the query on Product.
>>
>> Any idea.
> 
> I fear I got lost somewhere but did you know 'becomes' ?
> TransactionProduct.find(:first).product(true).becomes(ProductVT)
> 
> BTW, the product(true) that I used is is quite(?) the same like
> product.reload
> 
> ciao, tom

-- 
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: Creating an object from a pp string?

2009-01-28 Thread Philip Hallstrom

> When I use pp on an object in rails, it prints out a nice string
> representation of the object.  I am trying to pass objects from one
> server to another and I am wondering if I can just pass this string  
> and
> create an object on the other server.  Any libraries/functions out  
> there
> that can do this?  Or any other way to do this (not necessarily using
> pp).

If you really want to go that route you might look at converting it to  
YAML... but I'd also suggest looking at JSON, XML, XML-RPC, REST,  
active resource, etc...

-philip

--~--~-~--~~~---~--~~
You received 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] Creating an object from a pp string?

2009-01-28 Thread Yanni Mac

When I use pp on an object in rails, it prints out a nice string
representation of the object.  I am trying to pass objects from one
server to another and I am wondering if I can just pass this string and
create an object on the other server.  Any libraries/functions out there
that can do this?  Or any other way to do this (not necessarily using
pp).

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

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



[Rails] Re: Best practices for develop a web service (server+client)?

2009-01-28 Thread Freddy Andersen

What about activeResource ?


On Jan 28, 11:02 am, Xdmx Xdmx 
wrote:
> Hi, i've two applications (APP1 and APP2) and i want that APP2 is able
> to get data from APP1. I think that a simple rest web service is the way
> to go. Do you have some good examples/tutorials? I've googled but i find
> only old examples with the deprecated action web service. From the
> client, who get the xml, how does reconvert it into ruby/model objects?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Calculate Page views efficiently

2009-01-28 Thread deepu

sullivan,
  thanks for the reply. But the very act of inserting into
any table means i cannot use  page caching which will be  aserious
performance penalty to pay.

i will explore the logs option though. thanks

Cheers,
Deepu.

On Jan 28, 11:15 pm, "sullivan.t"  wrote:
> Maybe with a distinct insert into a history table?  thread_views
> (thread_id int, view_count) outside of the before_filter... somewhere
> else?
>
> Or parsing of the logs?
>
> On Jan 28, 1:03 pm, deepu  wrote:
>
> > Hi,
> >      I am coding forum software in rails. In forum software how many
> > times a thread is viewed is an important metric .one way of doing this
> > is creating a before_filter which logs in a view everytime a page is
> > requested.
>
> > actually just because i need to run this before_filter i can't do page
> > caching which can drastically improve the performance of the app. can
> > anyone suggest a better way of logging views of every thread.
--~--~-~--~~~---~--~~
You received 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: Restful routes and Rails Console

2009-01-28 Thread Thomas R. Koll

Hi,

On Jan 28, 5:10 pm, Bharat Ruparel wrote:

> I am trying to see what comments_url resolves to in the Rails Console,
> but do not know how.

There's a good reason for this: You don't use/need urls in your
console.
The best way is to write tests for your routes, this will also give
you the
most confidence in your own code.

ciao, tom

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



[Rails] Re: Multi table inheritance problem with has_one relationship

2009-01-28 Thread Thomas R. Koll

Hi,

On Jan 27, 7:46 pm, Rémi Gagnon 
wrote:

> TransactionProduct.find(:first).product.relaod  (reload the product
> instance instead of ProductVT)
>
> Even if I see in the console that is a ProductVT it reloads Product.  I
> checked in development.log and in performs the query on Product.
>
> Any idea.

I fear I got lost somewhere but did you know 'becomes' ?
TransactionProduct.find(:first).product(true).becomes(ProductVT)

BTW, the product(true) that I used is is quite(?) the same like
product.reload

ciao, tom

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



[Rails] Best practices for develop a web service (server+client)?

2009-01-28 Thread Xdmx Xdmx

Hi, i've two applications (APP1 and APP2) and i want that APP2 is able
to get data from APP1. I think that a simple rest web service is the way
to go. Do you have some good examples/tutorials? I've googled but i find
only old examples with the deprecated action web service. From the
client, who get the xml, how does reconvert it into ruby/model objects?
-- 
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: User Interface / View Looks

2009-01-28 Thread Robby Russell

On Wed, Jan 28, 2009 at 10:13 AM, sullivan.t  wrote:
>
> What are people doing these days for the "user interface" side of
> applications?  I'm in the process of writing something, using a lot of
> CSS (good) but I keep getting the feel that this application ("rts")
> would be better shown to the world in a flash format on the view end.
> Thoughts? Adobe AIR?  Laszlo?


XHTML/CSS only requires on client-side plugin... a web browser. ;-)


Robby

-- 
Robby Russell
Chief Evangelist, Partner

PLANET ARGON, LLC
design // development // hosting w/Ruby on Rails

http://www.planetargon.com/
http://www.robbyonrails.com/
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]

--~--~-~--~~~---~--~~
You received 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: save value of text_field in the view

2009-01-28 Thread Maite Piedra

Hello list I have the same problem yet

I dont catch value of text_field in the same erb.html file.

any idea???

thanks 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-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: Calculate Page views efficiently

2009-01-28 Thread sullivan.t

Maybe with a distinct insert into a history table?  thread_views
(thread_id int, view_count) outside of the before_filter... somewhere
else?

Or parsing of the logs?

On Jan 28, 1:03 pm, deepu  wrote:
> Hi,
>      I am coding forum software in rails. In forum software how many
> times a thread is viewed is an important metric .one way of doing this
> is creating a before_filter which logs in a view everytime a page is
> requested.
>
> actually just because i need to run this before_filter i can't do page
> caching which can drastically improve the performance of the app. can
> anyone suggest a better way of logging views of every thread.
--~--~-~--~~~---~--~~
You received 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] User Interface / View Looks

2009-01-28 Thread sullivan.t

What are people doing these days for the "user interface" side of
applications?  I'm in the process of writing something, using a lot of
CSS (good) but I keep getting the feel that this application ("rts")
would be better shown to the world in a flash format on the view end.
Thoughts? Adobe AIR?  Laszlo?
--~--~-~--~~~---~--~~
You received 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] Calculate Page views efficiently

2009-01-28 Thread deepu

Hi,
 I am coding forum software in rails. In forum software how many
times a thread is viewed is an important metric .one way of doing this
is creating a before_filter which logs in a view everytime a page is
requested.

actually just because i need to run this before_filter i can't do page
caching which can drastically improve the performance of the app. can
anyone suggest a better way of logging views of every thread.
--~--~-~--~~~---~--~~
You received 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: Change Database Name

2009-01-28 Thread Dan Weaver

Matt Harrison wrote:
> 
> You could copy the database to the new name, and then change 
> database.yml.
> 
> Then you can delete the original database without any downtime.
> 
> HTH
> 
> Matt

Good suggestion, thank you.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Change Database Name

2009-01-28 Thread Matt Harrison

Dan Weaver wrote:
> Hi,
> 
> I'd like to change the name of the database for an app I have in
> production (the current name is too ambiguous). As I see it I will need
> to change the database.yml file and the database name in mysql. Is there
> anything else? A better way? Suggestions?
> 
> I want to be on the cautious side, for obvious reasons.
> 
> Thanks.

You could copy the database to the new name, and then change database.yml.

Then you can delete the original database without any downtime.

HTH

Matt

--~--~-~--~~~---~--~~
You received 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: How long do you take for each Development Cycle

2009-01-28 Thread Ar Chron


2 Developers * 3-4 Days * 40-50 Bugs < Happiness...

Feel free to alter the first, second and/or third terms until the 
equation balances.

It sounds like you have the correct processes in place, you just need 
some scope management.  With the idea that "less is more", fewer bugs 
attempted should yield less rework, and less missed dates (and maybe get 
you home in time for dinner).

Prioritize the bugs that are on the list, and don't be afraid to start 
tossing low priority bugs off the list if the scope of a higher priority 
change is larger than anticipated.

Overtime may work for short bursts, but fact is fact... tired 
programmers make mistakes.
-- 
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] Change Database Name

2009-01-28 Thread Dan Weaver

Hi,

I'd like to change the name of the database for an app I have in
production (the current name is too ambiguous). As I see it I will need
to change the database.yml file and the database name in mysql. Is there
anything else? A better way? Suggestions?

I want to be on the cautious side, for obvious reasons.

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

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



[Rails] Re: Redirecting root to mongrel prefix

2009-01-28 Thread jemminger


On Jan 28, 11:50 am, Freddy Andersen  wrote:
> I think you are missing a piece of the puzzle, Apache and
> mod_proxy...
>

Yes, this is running behind Apache.  We have a Java app that runs at
  http://java.ourdomain.com/foo

We have Apache proxy forwarding http://java.ourdomain.com/bar to
  http://rails.ourdomain.com/bar

...so that ajax calls aren't cross-domain to the java app.


The issue with redirecting the root requests to the prefixed URL is
more a matter of convenience, just so someone doesn't see "NOT FOUND"
if they happen to hit the root URL.

--~--~-~--~~~---~--~~
You received 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: Rails runtime

2009-01-28 Thread Frederick Cheung


On 28 Jan 2009, at 16:36, Camille Roux wrote:

>
> Hi,
>
> I've a question about the Rails runtime.
> I'd like to know which part of Rails is executed (and put in memory)  
> at
> each request? at each server launch?
> In other words, is Rails like PHP (the whole code is "executed" at  
> each
> request)?

All of your app code (and the framework) is loaded when the mongrel,  
passenger instance etc. is launched (passenger can do clever things  
with fork if you're using REE).

Fred
>
>
> Thanx
> Camille Roux
> -- 
> 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: How to add fields dynamically?

2009-01-28 Thread Aa Sh

Phlip, Peter, and Bharat,

Thank you for advises and your time!
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Redirecting root to mongrel prefix

2009-01-28 Thread Freddy Andersen

I think you are missing a piece of the puzzle, Apache and
mod_proxy...

You would never run multiple app roots unless you had multiple apps
and or a php app on / and a rails app on /app1...

If you want multiple apps running on your dev env just start them with
-p 3001 -p 3002 ... ? much easier... but I guess that depends on what
you are trying to do ...
--~--~-~--~~~---~--~~
You received 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] Rails runtime

2009-01-28 Thread Camille Roux

Hi,

I've a question about the Rails runtime.
I'd like to know which part of Rails is executed (and put in memory) at
each request? at each server launch?
In other words, is Rails like PHP (the whole code is "executed" at each
request)?

Thanx
Camille Roux
-- 
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: Restful named member routs is not decoded correctly

2009-01-28 Thread Rob Biedenharn

On Jan 28, 2009, at 9:45 AM, Hans wrote:
> I define my own member action in the root file as
> map.resources  :helps

You don't need the first one, the second (with the :member option)  
does what you need.

>
> map.resources  :helps, :member => {:display => :put}
>
> The tables  listed by rake routs displays the pathes and helpers as
> display_help  PUT/helps/:id/display
> {:controller=>"helps", :action=>"display"}
> formatted_display_help PUT/helps/:id/display.:format
> {:controller=>"helps", :action=>"display"}
>
> I am using it in a link in the view as display_help_path
> (:id=>'What_is_Disweb')
> and the url in the corresponding link is
> http://localhost:3000/hepls/What_is_Disweb/display

You've stipulated that the method used for the display action must be  
PUT, so if you click on a link, that's a GET and it is most likely  
matching the default route:
map.connect '/:controller/:action/:id'

>
>
> This seems all OK, but rails tell me that it cannot find an action
> named What_is_Disweb, when I click on the link
> I seems as the url is decoded as I had not add the member action
>
> Anyone that has any ideas of what is going on ? Has anyone met the
> same problem ?
> What mistakes have I done ? What are the sources of my problem ?
> I am displaying the link in another window ? Is that the source of the
> problem?
> I have tried to find the source of the probllem for hours, but without
> any success.
>
> Any help is very much appreciated


Try having just:

map.resources :helps, :member => {:display => :get}

and see if your problem goes away.

I'd also recommend commenting out the default routes and add the  
actual routing that you need.

-Rob

Rob Biedenharn  http://agileconsultingllc.com
r...@agileconsultingllc.com



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



[Rails] Re: How to add fields dynamically?

2009-01-28 Thread Bharat Ruparel

You will need Javascript for this sort of thing as Ryan Bates points out 
in his screen casts.  There are many ways to do it, e.g., RJS templates 
or unobstrusive Javascript.

Next in your create action, you will have to loop through the newly 
added rows to the database.

It sounds simple, but it isn't if you are a beginning Rails programmer. 
You may want to get a bit more experience with Javascript/Ajax before 
trying this.  However, if you must, lookup the multi-model update recipe 
in Advanced Rails Recipes Book contributed by Ryan Bates and just 
exclude the "one" side of "one-to-many" relationship.

Bharat
-- 
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: ajax search feature works in FF but not IE

2009-01-28 Thread Pardee, Roy

Fantastic!  That did the trick.  Thanks! 

-Original Message-
From: rubyonrails-talk@googlegroups.com 
[mailto:rubyonrails-t...@googlegroups.com] On Behalf Of Mark Reginald James
Sent: Tuesday, January 27, 2009 6:07 PM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Re: ajax search feature works in FF but not IE


Pardee, Roy wrote:

> <%= observe_field('project_search',
> :url => { :controller => "projects", :action => "index_search"},
> :update => "project-list",
> ...
> That partial renders a table w/one row per project.  This works just 
> fine from FireFox.  But from IE I don't get my table--just a blank page.  So 
> the records that used to be in my table id="project-list" are gone, but I 
> don't see the new ones that index_search queried out of the db.  Judging from 
> the log, IE is indeed making the request to index_search, passing the params 
> it should, etc.  The log even says, e.g., ...
> But IE doesn't seem to want to actually *display* these guys.  FF's web 
> development toolbar tells me I'm in "standards compliance mode" when I pull 
> up a searched list of projects, so I believe the markup is all kosher.


:update changes the innerHTML of a node, so you will be inserting the table 
inside the table tag.

Wrap a div around the table and update that instead.

--
Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.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] Restful routes and Rails Console

2009-01-28 Thread Bharat Ruparel

The following is a snippet of the routes.rb file:

  map.resources :blogs do |blog|
blog.resources :posts do |post|
post.resources :comments
end
  end


The index action in the CommentsController shows:

redirect_to comments_url

I am trying to see what comments_url resolves to in the Rails Console,
but do not know how.

Thanks in advance for your time and help.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: active_scaffold + i18n

2009-01-28 Thread Peter De Berdt

On 28 Jan 2009, at 16:11, natematias wrote:

> Simple Localization apparently has support for Active Scaffold
> translation.
> http://simple-localization.arkanis.de/
>
> I do not however know what the the implications of recent I18n changes
> in Rails have been to either Simple Localization or Active Scaffold.

Well, we're using Simple Localization in several of our apps and are  
postponing upgrading them to Rails 2.2 since Simple Localization  
doesn't work with it. I still find it superior to what Rails itself  
currently offers though. Also note that the last activity on the  
plugin was 7 months ago (although I noticed a recent import into  
github), so if you want Rails 2.2 compatibility, you'll either have to  
wait or do it yourself. We probably will some time in the future (or  
switch to Rails I18n), but we simply don't have the time right now.


Best regards

Peter De Berdt


--~--~-~--~~~---~--~~
You received 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: progress bar

2009-01-28 Thread Anubhaw Prakash

Piyush with Rails wrote:
> Have you tried Mongrel upload progress bar plugin. find the link
> below.
> 
> http://mongrel.rubyforge.org/wiki/UploadProgress
> 
> There is a caution with this: it needs Apache Web Server. it will not
> work for Nginx.
> 
> Thanks,
> Piyush.
> 
> On Jan 26, 1:08 pm, Anubhaw Prakash 

Thanks man. I will try it and respond to you.
Anubhaw.
-- 
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: how to delete temp files

2009-01-28 Thread jemminger


http://www.ruby-doc.org/core-1.8.6/classes/FileUtils.html#M004365

--~--~-~--~~~---~--~~
You received 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: javascript function needs rails variable

2009-01-28 Thread jemminger

This will only work if that script block is in an .erb template.

On Jan 28, 1:02 am, Rabia  wrote:
> 
>
>     document.getElementById('h').checked=true;
>     show_coords(<%= @pic_comments.to_json %>,"main",'<%=$domain%>/
> users/update_picture_div',<%= @picture.id %>)
>
>  
> I have implement this but rails variables are not working.
--~--~-~--~~~---~--~~
You received 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: Best find for the job...

2009-01-28 Thread jemminger

In my opinion, the best way is the first way that works.  If that
method proves to be too inefficient, then optimize afterwards.


On Jan 28, 10:03 am, Neal L  wrote:
> Hi all,
>
> I'm trying to find the most effective way to generate an aggregation
> report.  The models involved are:
>
> Customer  --(has_many)--> Charges
> Charges --(have_one)-->Account
>
> What I'm trying to do is find the total charges during the year for
> each customer by account.  In other words, a function like:
>
> customer.charges_for_year()
>
> in the customer model that will return a hash of each account charged
> and the customer's total charges to that account.
>
> From what I've read I don't think I should be using named_scope, since
> this involves associations...
>
> Any ideas?
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: active_scaffold + i18n

2009-01-28 Thread natematias

Philippe,

Simple Localization apparently has support for Active Scaffold
translation.
http://simple-localization.arkanis.de/

I do not however know what the the implications of recent I18n changes
in Rails have been to either Simple Localization or Active Scaffold.

--J. Nathan Matias
www.natematias.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] Redirecting root to mongrel prefix

2009-01-28 Thread jemminger

Mongrel can be started with a prefix e.g.

  mongrel_rails start -p 3000 --prefix /foobar

So that all of the app's URLs are prefixed, e.g.

  http://localhost:3000/foobar
  http://localhost:3000/foobar/posts
  http://localhost:3000/foobar/posts/1

The problem is that if you hit just the root ( http://localhost:3000/
) then mongrel responds with "NOT FOUND".

I tried adding an index.html to RAILS_ROOT/public that redirects to /
foobar, but this results in an infinite loop.

Does anyone know how to get requests to the root to redirect to the
prefix?

--~--~-~--~~~---~--~~
You received 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: How to add fields dynamically?

2009-01-28 Thread Aa Sh

Peter De Berdt wrote:
> On 28 Jan 2009, at 00:13, Aa Sh wrote:
> 
>> I would like have a simple interface for users to add data into
>> database. How to add new textareas in form, until user want it and
>> submit all of them at once?
> 
> http://railscasts.com/episodes/73-complex-forms-part-1
> http://railscasts.com/episodes/74-complex-forms-part-2
>   ... and everything on railscasts.com basically
> 
> 
> Best regards
> 
> Peter De Berdt

Thank you so much, it is almost exactly what I need, except I am a 
novice in RoR, so I can't change the example from multi models to simple 
one. I try, but have an error.

Now I have table in database with "e_key" and "comment" fields and 
standard new.html.erb (built by scaffolding). So actually I have two 
question:
1) How dynamically to add empty fields on page (by click button)?
2) How to collect all data from all rows and put they into database?

Thank you for your time!

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

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



[Rails] How does facebook’s Share a link feature work?

2009-01-28 Thread Ahmed Sobhi

I wanted to implement that feature in a Rails application I'm buidling.
A user posts a url, and voila, he gets a better representation for that
url.

I already dealt with a similar feature before where the requirement was
to replace a given url with the page's title and favicon.

Facebook go beyond that and if it's youtube it gives you an embed object
and so on. I asked the same question on stackoverflow
http://stackoverflow.com/questions/477899/how-does-facebooks-share-a-link-feature-work
where I was introduced to oEmbed and oohEmbed. I guess they are great.

What I want exactly is
1. A user attaches a url with his blog post for example
2. when showing that blog post, one of the following things should
happen
a) If youtube and other video sites, embed that video in its proper
player
b) if an image, show the thumbnail
c) else, show a page's title and description

I wanted to know what ideas come to your mind if you were faced with
implementing such a feature. One thing to mention is that this feature
will be used in my application heavily, or should I say all the time so
the solution should really pay much attention to performance.
-- 
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: site content blocks

2009-01-28 Thread Jean-Marc (M2i3.com)

How about creating a model (and a table) called contact
information

You're code will be a lot cleaner and meaningfull.

usually compagnies have multiple contacts they like to make visible,
having a model for such purpose should provide good starting point and
allow for expension (like one business contact, the invoicing contact,
etc.)

Regards,

Jean-Marc
http://m2i3.com/


On Jan 28, 1:10 am, torp  wrote:
> newbie question:
>
> what is the best way in rails to make content managed data that isn't
> iterated? eg. on a 'contact us' page i have an business address field
> that the client needs to be able to update, and there are many other
> fields on the site that need to be content managed should i create
> one table that stores all this data and access it in the pages action?
>
> i've created a table called 'blocks' which contains fields 'id',
> 'name' and 'content'
>
> and in the controller
>
> def contactus
>      address = Block.find(:first, :conditions => { :name =>
> "businessaddress"})
> end
>
> which i can then access from the view, except this seems cumbersome.
>
> better ideas?
--~--~-~--~~~---~--~~
You received 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] Best find for the job...

2009-01-28 Thread Neal L

Hi all,

I'm trying to find the most effective way to generate an aggregation
report.  The models involved are:

Customer  --(has_many)--> Charges
Charges --(have_one)-->Account


What I'm trying to do is find the total charges during the year for
each customer by account.  In other words, a function like:

customer.charges_for_year()

in the customer model that will return a hash of each account charged
and the customer's total charges to that account.

>From what I've read I don't think I should be using named_scope, since
this involves associations...

Any ideas?

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



[Rails] Restful named member routs is not decoded correctly

2009-01-28 Thread Hans

I define my own member action in the root file as
 map.resources  :helps
 map.resources  :helps, :member => {:display => :put}

The tables  listed by rake routs displays the pathes and helpers as
display_help  PUT/helps/:id/display
{:controller=>"helps", :action=>"display"}
formatted_display_help PUT/helps/:id/display.:format
{:controller=>"helps", :action=>"display"}

I am using it in a link in the view as display_help_path
(:id=>'What_is_Disweb')
and the url in the corresponding link is
http://localhost:3000/hepls/What_is_Disweb/display

This seems all OK, but rails tell me that it cannot find an action
named What_is_Disweb, when I click on the link
I seems as the url is decoded as I had not add the member action

Anyone that has any ideas of what is going on ? Has anyone met the
same problem ?
What mistakes have I done ? What are the sources of my problem ?
I am displaying the link in another window ? Is that the source of the
problem?
I have tried to find the source of the probllem for hours, but without
any success.

Any help is very much appreciated




--~--~-~--~~~---~--~~
You received 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: Override or delete the layouts that are generated by scaffold generated code?

2009-01-28 Thread Ar Chron

Are you pointing your scaffolded controllers at the application layout?

class ScaffoldedController < ApplicationController
  layout "mylayout.html.erb"

  blah blah blah
end
-- 
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] How long do you take for each Development Cycle

2009-01-28 Thread Arthur Chan

Hi guys,

I don't know if this question is proper to post here. But I think it is
related to every developer, so I post.

I am using RoR for developments more than a year. We are using Bugzilla.
We do unit, funcitonal and watir tests.

We usually schedule to do around 40-50 bugs for each development cycle
and it scheduled to take 3-4 days.

Most of the tasks involve RoR MVC modification, documentation, testings,
CSS style, debuggings, modify jQuery plugins.

And we maintain for IE6, ie7 and FF3.


However, most of the time we cannot meet schedule and bugs are often
found (around 10-25% need to reopen).

I am quite frustrated about that although we tried our best and Overtime
works, the result is not suitable.

How about yours? Is the cycle/time too short? or any tools (RoR,
Bugzilla) do we used inproperly?

We are small company only 2 developers. And the freelance designer has
left for a while. We do wanna change the situations, if you have similar
situations or you know our problem, I do appreciate your comment and
help!

Thanks, and Happy Year of the Ox !
Arthur
-- 
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: format.html and redirect_to

2009-01-28 Thread Frederick Cheung



On 28 Jan 2009, at 10:30, Ricky  wrote:

>
> I was wondering what the purpose of wrapping a redirect_to in a
> format.html block is. I get why you'd want to do this with a render,
> but if you're redirecting the browser to another URL, what's the
> point? As I understand it, when redirect_to is called, Rails sends a
> 302 back to the browser,

It might not be a browser. Eg with a create action you would typically  
redirect browsers to the show action, but the XML api probably  
wouldn't do that.

Fred


> so I'm having trouble understanding why
> format plays any part in this. No biggie, just need some clarification
> on what's actually happening.
>
> Cheers,
> Ricky
> >

--~--~-~--~~~---~--~~
You received 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: Submit buttons with rollover images

2009-01-28 Thread Txarli San

Michael Slater wrote:
> The image_submit_button helper makes it easy enough to use images as
> submit buttons, but they don't have any rollover effects. I've seen
> various JS approaches to make this work, but I'm wondering if there's
> a preferred Rails way to do this.
> 
> Has anyone seen a replacement for image_submit_button that takes two
> (or three) images instead of one, and creates the rollover code?
> 
> Michael

This is the "rails" aproach...

<%= image_submit_tag "btn-off.jpg", :mouseover => "btn-on.jpg"%>


:)

Regards
-- 
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] How to give onchange for select_year rails helper....

2009-01-28 Thread rails and rails only

<%=select_year(Date.today,:include_blank=>true, :start_year =>
Date.today.strftime("%Y").to_i, :end_year => 1999)%>


i am using rhis helper... now i want to give onchange here

Please help me to solve this 




thanks in advance
JK
-- 
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: Apply style in collection_select ?????

2009-01-28 Thread Frederick Cheung


On 28 Jan 2009, at 07:34, Dharmdip Rathod wrote:

>
> Thanks a lot ,
> but it is not working here actually your suggested code is breaking my
> java script and style problem is still there , but never mind .  
> Actually
> here this issue is looking some critical because i can not see html
> generated code in source when i write this
>
> <%= collection_select(:customer, :country_id,
> @countries, :id, :country, {:style => 'width:100px;', :onchange =>
> "updateState('');", :id => 'country_id'}) %>

It's the usual "the first hash is options, the second is for html  
options" thingy.
>
>
> help...
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


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



[Rails] format.html and redirect_to

2009-01-28 Thread Ricky

I was wondering what the purpose of wrapping a redirect_to in a
format.html block is. I get why you'd want to do this with a render,
but if you're redirecting the browser to another URL, what's the
point? As I understand it, when redirect_to is called, Rails sends a
302 back to the browser, so I'm having trouble understanding why
format plays any part in this. No biggie, just need some clarification
on what's actually happening.

Cheers,
Ricky
--~--~-~--~~~---~--~~
You received 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] Override or delete the layouts that are generated by scaffold generated code?

2009-01-28 Thread Marksu

Is it possible to ‘override’ or remove the layouts that are generated
by scaffold generated code?

I have a application.html.erb layout that works perfectly with my CSS/
DIV based navigation and all I want to do is create some CRUD pages
for a couple of database tables.  But I want them to live in the
application template that I have already created…

I've tried deleting the scaffold layouts from the app/views/layouts
and I get an error from WEBrick looking for the StyleSheets??

  ActionController::UnknownAction (No action responded to
stylesheets):

I'm using Rails 2.0.2

Thanks in advance!

Marksu


--~--~-~--~~~---~--~~
You received 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] site content blocks

2009-01-28 Thread torp

newbie question:

what is the best way in rails to make content managed data that isn't
iterated? eg. on a 'contact us' page i have an business address field
that the client needs to be able to update, and there are many other
fields on the site that need to be content managed should i create
one table that stores all this data and access it in the pages action?

i've created a table called 'blocks' which contains fields 'id',
'name' and 'content'

and in the controller

def contactus
 address = Block.find(:first, :conditions => { :name =>
"businessaddress"})
end

which i can then access from the view, except this seems cumbersome.

better ideas?

--~--~-~--~~~---~--~~
You received 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: how to create a permanent record in table

2009-01-28 Thread Adam Akhtar

Thanks everyone for your input. Yes I did only want to protect one of 
the records so ill give your (roberts) method a shot!

thank you very much
-- 
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] X_send_file download 1byte file instade of original size

2009-01-28 Thread Dharmdip Rathod

i m using x_send_file pluggins and download file then only 1byte file is
downloaded.

in Controller
x_send_file("#{RAILS_ROOT}/public#{params[:file]}")

if you have idea for this problem so give me a solution
-- 
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: RubyOnRails with MS SQL - Connectivity Error

2009-01-28 Thread Luke Pearce

> I have also installed the gem dbi-0.4.0 

Tony,

I would stick with the older version of ADO one of the 2.x series I'm 
not sure it'll work with the new dbi.

Cheers
Luke
-- 
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
-~--~~~~--~~--~--~---