This page: http://www.rails-engines.org/download makes it sound like SVN is optional for using engines, but when I try to run the second command ("ruby script/plugin install engines"), I get the NoMethodError on nil as described in the second issue reported here: http://www.rails-engines.org/wiki/pages/Engines+plugin%3A+Known+Issues So, which is it? Do I have to have SVN installed to use engines? b
It''s more correct to say that the plugin installer script provided with Rails itself seems to require SVN - can you install any plugins using that script? I''m not sure why this might be the case, because there is certainly implementation in plugin.rb for falling-back to HTTP only. - james On 1/24/06, Ben Munat <bent@munat.com> wrote:> This page: > > http://www.rails-engines.org/download > > makes it sound like SVN is optional for using engines, but when I try to run the second > command ("ruby script/plugin install engines"), I get the NoMethodError on nil as > described in the second issue reported here: > > http://www.rails-engines.org/wiki/pages/Engines+plugin%3A+Known+Issues > > So, which is it? Do I have to have SVN installed to use engines? > > b > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
It doesn''t look like my plugin script is going to work for any plugins... C:\workspace31\engineTest>ruby script\plugin list script/plugin: No such file or directory - svn ls http://dev.rubyonrails.com/svn/rails/plugins/ C:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/plugin.rb:313:in `plugins'': private method ` split'' called for nil:NilClass (NoMethodError) etc... I took a quick look at plugin.rb and it looks like it''s supposed to check if I have the "svn" command, and fall back to http if not. But apparently that ain''t happening. Will try to debug more tonight. As a side question, yesterday I discovered that I had been using rails 0.10.0 all along (gem thought that 0.10.0 is newer than 1.0!?) and after I successfully got 1.0 installed, I started to notice the *nix shebang line everywhere... might that be a problem? My rails apps all appear to still work though... b James Adam wrote:> It''s more correct to say that the plugin installer script provided with Rails itself > seems to require SVN - can you install any plugins using that script? I''m not sure why > this might be the case, because there is certainly implementation in plugin.rb for > falling-back to HTTP only. > > - james > > On 1/24/06, Ben Munat <bent@munat.com> wrote: > >> This page: >> >> http://www.rails-engines.org/download >> >> makes it sound like SVN is optional for using engines, but when I try to run the >> second command ("ruby script/plugin install engines"), I get the NoMethodError on nil >> as described in the second issue reported here: >> >> http://www.rails-engines.org/wiki/pages/Engines+plugin%3A+Known+Issues >> >> So, which is it? Do I have to have SVN installed to use engines? >> >> b _______________________________________________ Rails mailing list >> Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ Rails mailing list > Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails
I don''t know if it was "required" but I had to install subversion (svn) in order to install the login engine. Greg On 1/24/06, Ben Munat <bent@munat.com> wrote:> This page: > > http://www.rails-engines.org/download > > makes it sound like SVN is optional for using engines, but when I try to run the second > command ("ruby script/plugin install engines"), I get the NoMethodError on nil as > described in the second issue reported here: > > http://www.rails-engines.org/wiki/pages/Engines+plugin%3A+Known+Issues > > So, which is it? Do I have to have SVN installed to use engines? > > b > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Greg Freemyer The Norcross Group Forensics for the 21st Century
Since engines are installed using the *exact same* mechanism as plugins, this problem can''t be specific to them. Can anyone else comment, or shed some light as to why the plugin installer seems to _need_ SVN? On 1/25/06, Greg Freemyer <greg.freemyer@gmail.com> wrote:> I don''t know if it was "required" but I had to install subversion > (svn) in order to install the login engine. > > Greg > > On 1/24/06, Ben Munat <bent@munat.com> wrote: > > This page: > > > > http://www.rails-engines.org/download > > > > makes it sound like SVN is optional for using engines, but when I try to run the second > > command ("ruby script/plugin install engines"), I get the NoMethodError on nil as > > described in the second issue reported here: > > > > http://www.rails-engines.org/wiki/pages/Engines+plugin%3A+Known+Issues > > > > So, which is it? Do I have to have SVN installed to use engines? > > > > b > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Greg Freemyer > The Norcross Group > Forensics for the 21st Century > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Yeah, sorry... I said I was going to debug this some more but then I got sidetracked... I left off looking at rails-1.0/lib/plugin.rb... the error is thrown on line 313 in Repositories#plugins. Looking around in there a bit, it appears the intention is to try svn but fall back to http if the commands not found. I also see that there''s an option to specify a url, but if I do this: ruby script\plugin list --source=http://dev.rubyonrails.com/svn/rails/plugins/ I still get the same error: script/plugin: No such file or directory - svn ls http://dev.rubyonrails.com/svn/rails/plugins/ C:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/plugin.rb:313:in `plugins'': private method `split'' called for nil:NilClass (NoMethodError) from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/plugin.rb:469:in `parse!'' from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/plugin.rb:469:in `map'' b James Adam wrote:> Since engines are installed using the *exact same* mechanism as > plugins, this problem can''t be specific to them. Can anyone else > comment, or shed some light as to why the plugin installer seems to > _need_ SVN? > > On 1/25/06, Greg Freemyer <greg.freemyer@gmail.com> wrote: > >>I don''t know if it was "required" but I had to install subversion >>(svn) in order to install the login engine. >> >>Greg >> >>On 1/24/06, Ben Munat <bent@munat.com> wrote: >> >>>This page: >>> >>>http://www.rails-engines.org/download >>> >>>makes it sound like SVN is optional for using engines, but when I try to run the second >>>command ("ruby script/plugin install engines"), I get the NoMethodError on nil as >>>described in the second issue reported here: >>> >>>http://www.rails-engines.org/wiki/pages/Engines+plugin%3A+Known+Issues >>> >>>So, which is it? Do I have to have SVN installed to use engines? >>> >>>b >>>_______________________________________________ >>>Rails mailing list >>>Rails@lists.rubyonrails.org >>>http://lists.rubyonrails.org/mailman/listinfo/rails >>> >> >> >>-- >>Greg Freemyer >>The Norcross Group >>Forensics for the 21st Century >>_______________________________________________ >>Rails mailing list >>Rails@lists.rubyonrails.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Hello, I am learning Ruby on Rails and have a very basic question. def self.home_categories (portal_id) find(:all, :conditions => "portal_id=:portal_id" ) end How can I put the value of portal_id in the string "portal_id=...". I tried concatenation but I get the error that it cannot convert. I can figure it out eventually but thought someone may have the answer ready. Thanks Frank --------------------------------- Do you Yahoo!? With a free 1 GB, there''s more in store with Yahoo! Mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060126/d5dd6c86/attachment.html
Easy, ruby can embed expressions into strings: def self.home_categories (portal_id) find(:all, :conditions => "portal_id=#{portal_id}" ) end The #{..} syntax acts like ruby code inside your string, so the value of portal_id gets into your conditions. Now, the fact you are putting this value directly into a SQL statement might be troubling - it it''s from some sort of form submission or URL you are opening yourself to SQL injection attacks there. On 1/25/06, softwareengineer 99 <softwareengineer99@yahoo.com> wrote:> Hello, > > I am learning Ruby on Rails and have a very basic question. > > def self.home_categories (portal_id) > find(:all, > :conditions => "portal_id=:portal_id" > ) > end > > How can I put the value of portal_id in the string "portal_id=...". I tried > concatenation but I get the error that it cannot convert. > > I can figure it out eventually but thought someone may have the answer > ready. > > Thanks > Frank > > > ________________________________ > Do you Yahoo!? > With a free 1 GB, there''s more in store with Yahoo! Mail. > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Hey, You probably want something like this def self.home_categories (portal_id) find(:all, :conditions => [ "portal_id=?", portal_id ] ) end Eric softwareengineer 99 wrote:> Hello, > > I am learning Ruby on Rails and have a very basic question. > > def self.home_categories (portal_id) > find(:all, > :conditions => "portal_id=:portal_id" > ) > end > > How can I put the value of portal_id in the string "portal_id=...". I > tried concatenation but I get the error that it cannot convert. > > I can figure it out eventually but thought someone may have the > answer ready. > > Thanks > Frank > > ------------------------------------------------------------------------ > Do you Yahoo!? > With a free 1 GB, there''s more in store with Yahoo! Mail. > <http://us.rd.yahoo.com/mail_us/taglines/mailstorage/*http://mail.yahoo.com/> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Wow, you somehow replied to one thread with the subject line from another thread and were starting a completly new thread! Please, when you have a new question, compose a fresh, new email addressed to rails@lists.rubyonrails.org and with a subject line that relates to your question.... It makes the sheer volume of this list easier to manage. Thanks, b softwareengineer 99 wrote:> Hello, > > I am learning Ruby on Rails and have a very basic question. > > def self.home_categories (portal_id) > find(:all, > :conditions => "portal_id=:portal_id" > ) > end > > How can I put the value of portal_id in the string "portal_id=...". I > tried concatenation but I get the error that it cannot convert. > > I can figure it out eventually but thought someone may have the answer > ready. > > Thanks > Frank > > ------------------------------------------------------------------------ > Do you Yahoo!? > With a free 1 GB, there''s more in store with Yahoo! Mail. > <http://us.rd.yahoo.com/mail_us/taglines/mailstorage/*http://mail.yahoo.com/> > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
I did send a new message to rails@lists.rubyonrails.org. Don''t know how it happened. I made sure to put a unique/new subject line "How to use a parameter with a string?" I do know how to submit a question just don''t know how it got mixed up. My apologies anyway to the list members. Frank Ben Munat <bent@munat.com> wrote: Wow, you somehow replied to one thread with the subject line from another thread and were starting a completly new thread! Please, when you have a new question, compose a fresh, new email addressed to rails@lists.rubyonrails.org and with a subject line that relates to your question.... It makes the sheer volume of this list easier to manage. Thanks, b softwareengineer 99 wrote:> Hello, > > I am learning Ruby on Rails and have a very basic question. > > def self.home_categories (portal_id) > find(:all, > :conditions => "portal_id=:portal_id" > ) > end > > How can I put the value of portal_id in the string "portal_id=...". I > tried concatenation but I get the error that it cannot convert. > > I can figure it out eventually but thought someone may have the answer > ready. > > Thanks > Frank > > ------------------------------------------------------------------------ > Do you Yahoo!? > With a free 1 GB, there''s more in store with Yahoo! Mail. > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails --------------------------------- Do you Yahoo!? With a free 1 GB, there''s more in store with Yahoo! Mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060126/ec3a583a/attachment.html
Thanks Justin for your answer and the detailed explanation. I appreciate it very much. Frank Justin Bailey <jgbailey@gmail.com> wrote: Easy, ruby can embed expressions into strings: def self.home_categories (portal_id) find(:all, :conditions => "portal_id=#{portal_id}" ) end The #{..} syntax acts like ruby code inside your string, so the value of portal_id gets into your conditions. Now, the fact you are putting this value directly into a SQL statement might be troubling - it it''s from some sort of form submission or URL you are opening yourself to SQL injection attacks there. On 1/25/06, softwareengineer 99 wrote:> Hello, > > I am learning Ruby on Rails and have a very basic question. > > def self.home_categories (portal_id) > find(:all, > :conditions => "portal_id=:portal_id" > ) > end > > How can I put the value of portal_id in the string "portal_id=...". I tried > concatenation but I get the error that it cannot convert. > > I can figure it out eventually but thought someone may have the answer > ready. > > Thanks > Frank > > > ________________________________ > Do you Yahoo!? > With a free 1 GB, there''s more in store with Yahoo! Mail. > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails --------------------------------- Do you Yahoo!? With a free 1 GB, there''s more in store with Yahoo! Mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060126/b72ad20b/attachment.html
Thanks Eric for your reply. Eric Goodwin <ruby@ericgoodwin.com> wrote: Hey, You probably want something like this def self.home_categories (portal_id) find(:all, :conditions => [ "portal_id=?", portal_id ] ) end Eric --------------------------------- Bring words and photos together (easily) with PhotoMail - it''s free and works with Yahoo! Mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060126/f62396b4/attachment.html
No, I am not using a direct value from the forms. However, I would appreciate if you can tell me how would one add slashes to the string, or replace the quotes from the input value. I know it can be done in PHP using addslashes and str_replace. What are the appropriate functions in Ruby on Rails? I am sure many of us starting out on ROR would benefit from your answer. Thanks for your assistance. Frank Justin Bailey <jgbailey@gmail.com> wrote:Now, the fact you are putting this value directly into a SQL statement might be troubling - it it''s from some sort of form submission or URL you are opening yourself to SQL injection attacks there. --------------------------------- Do you Yahoo!? With a free 1 GB, there''s more in store with Yahoo! Mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060126/ddc9e2eb/attachment.html
Frank- You do not need to call any special functions to add slashes or escape things for the database in rails as long as you use the place holder syntax. So if you just get in the habit of always using the ? placeholders like you were shown with the snippet below, you will not have to worry about escaping anything before inserting or querying the db: def self.home_categories (portal_id) find(:all, :conditions => [ "portal_id=?", portal_id ] ) end This is the important syntax: :conditions => [ "portal_id=?", portal_id ] Cheers- -Ezra PS. what was meant when someone mentioned that you highjacked a thread in the list was that if you hit reply to an even replace the subject line. the in-reply-to headers that the mailing list uses to put together threads will lump your post in with the previous thread you replied to. So in the future when you want to start a new thread, please make sure to create a fresh new email in your email client and send it to the address: rails@lists.rubyonrails.org and you will avoid the thread highjacking. PPS. Welcome to the rails community. You will like it here. On Jan 25, 2006, at 6:50 PM, softwareengineer 99 wrote:> No, I am not using a direct value from the forms. > > However, I would appreciate if you can tell me how would one add > slashes to the string, or replace the quotes from the input value. > I know it can be done in PHP using addslashes and str_replace. What > are the appropriate functions in Ruby on Rails? > > I am sure many of us starting out on ROR would benefit from your > answer. > > Thanks for your assistance. > Frank > > Justin Bailey <jgbailey@gmail.com> wrote: > Now, the fact you are putting this value directly into a SQL statement > might be troubling - it it''s from some sort of form submission or URL > you are opening yourself to SQL injection attacks there. > > > Do you Yahoo!? > With a free 1 GB, there''s more in store with Yahoo! Mail. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra@yakima-herald.com 509-577-7732 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060126/4f489450/attachment.html