[Rails] Re: RoR deployment and maintenance
If you have a relatively simple site, you can use rsync with exluded files/directories for production deployment from your build environment. We use Ubuntu 8.04 and run RoR with nginx and thin. They work quite well. Thin has smaller footprint. We used to run mongrel_cluster with apache2, that works too. cheers, rp8 Krishna wrote: > Hi, > I have a developed and working RoR prototype. So far its been > mostly in development mode environment and under script/server on > windows .I want to move it to a hosting server and continue > development. > > Whats the best option? - How good is Ubuntu 7? I tried that first as I > have experience on that.I have been able to configure and get my app > running but looking for tips on maintaining the setup and continuing > development. > > Also what are the best practices for deployment..I just find myself > doing development on my box and manually ftp-ing the changed > files.Ideally I want to set up some kind of script / source control > where if i can check in stuff to my hosting server (except for config > details ) after changes are done and I am done testing.. > > Is there some source that can help me out > > > vk. -- 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: Issues With New Site
Hi Rob, Partials sounds the go to me ! cheers Dave On Dec 20, 3:06 am, Rob Pa wrote: > Hi, > > I am using Ruby on Rails to create a new site. > > On every page, I want to have a log in box. I also want to display the > latest 5 news items on all the pages as well. > > How could I go around this? Is it possible to have @news = > News.find(:all, :limit => 5 ) in the application handler, and then call > the @news on all pages? > > Would I also be able to handle the log in code in the main application > controller aswell? > > Thanks a lot, > Rob > -- > 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: mySQL newbie seek help with db indexing
On Dec 20, 1:01 am, Jeff Pritchard wrote: > Hi, > I don't quite understand the syntax for database indexes and/or how the > work to help speed up specific database searches. Can somebody suggest > a set of indexs that would make this set of queries go faster? [...] Very simple: you can profit by indexing on almost anything you're going to be doing a lot of searching on. In this case, that means that you should consider building indices on your foreign key fields (such as contacts.user_id), since they're what you're searching on in these queries. But before you do that, you might want to try EXPLAIN SELECT on the queries you're interested in, and see what mySQL tells you about where the bottlenecks are. Best, -- Marnen Laibow-Koser mar...@manren.org http://www.marnen.org --~--~-~--~~~---~--~~ You received 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: uninitialized constant BooksController::Books
Mark Reginald James wrote: > Newone One wrote: >> hi new to rails ... >> wat does it means... >> uninitialized constant BooksController::Books >> >> /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:102:in >> `const_missing' >> app/controllers/books_controller.rb:5:in `index' > > Most likely you have written Books.find instead of Book.find. > > -- > Rails Wheels - Find Plugins, List & Sell Plugins - > http://railswheels.com thanks alot :)i made it right... -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Problem with Regular Expression
On Dec 19, 3:08 pm, Corey Murphy wrote: > Frederick Cheung wrote: > > Pretend you're split. You see the comma after doe so you split. Then > > you see the other part of your regex and so you split again, resulting > > in the empty array > > > Fred > > Ok, but the pipe character stands for alternation much like an OR so > once it sees doe and splits, the next part of the csv input it evaluates > should match to the monetary portion of the regex so it splits around > it. Maybe I'm just not getting somethings Maybe not. :) Frederick is absolutely right. Here's what I believe happens when split is working on your input string. The split routine starts parsing at the beginning of the string (I will represent the cursor in these examples with a #.) #john,doe,"1,200.99",training,12345 => [] At the moment, no results have been yielded, so the resulting array (after the =>) is still empty. Split runs until it sees a delimiter. john#,doe,"1,200.99",training,12345 => ['john'] Split discards the delimiter. john,#doe,"1,200.99",training,12345 => ['john'] Repeat for the next element ('doe') and delimiter (','). john,doe,#"1,200.99",training,12345 => ['john', 'doe'] Having just read a delimiter (','), split is now prepared to read the next value. But it doesn't see a value -- it sees another delimiter ('"1,200.99"', which matches your regex and is therefore considered a delimiter just like ','). Split therefore writes an empty array element. john,doe,#"1,200.99",training,12345 => ['john', 'doe', ''] Split skips over the delimiter -- but since the regexp contains *capturing parentheses*, split inserts the parenthesized portion of the match (which happens to match the whole delimiter) into the result set. john,doe,"1,200.99"#,training,12345 => ['john', 'doe', '', '"1,200.99"'] Split sees another delimiter (',') with no intervening value, so it writes another empty string. This time, the regexp that matches the delimiter has no parentheses, so split does not put it into the result set. john,doe,"1,200.99",#training,12345 => ['john', 'doe', '', '"1,200.99"', ''] Split reads the last two values, skipping the delimiter in between. john,doe,"1,200.99",training,12345# => ['john', 'doe', '', '"1,200.99"', '', 'training', '12345'] Does that make it clearer? Since you defined the "1,200.99" string as a delimiter, the fact that it appears in the result set at all is actually accidental, and due 100% to the parentheses that you put around it in the regexp. Remember, the regexp in split defines the pattern for the *delimiter*, not the *values*. If you're still confused about what the parentheses do, here's a minimal example: 'aabbcc'.split(/b+/) => ['aa', 'cc'] 'aabbcc'.split(/(b+)/) => ['aa', 'bb', 'cc'] > because I want it to split my > (comma delimited) input line based on comma or when a value is wrapped > with double quotes. I hate to break it to you, but a single regexp alone cannot handle this kind of parsing, because the meaning of a comma is *state- dependent* -- that is, a comma either acts as a delimiter or not, depending on whether an odd or even number of double quotes have been encountered since the beginning of the string. And regexps are not state-dependent, so that kind of logic is outside the capabilities of a regexp. You'll need to write some higher-level routines in Ruby -- or, as others have suggested, simply use an off-the-shelf CSV parser. (I'd choose the latter approach if I were you -- parsers are a pain to get right!) Best, -- Marnen Laibow-Koser mar...@marnen.org http://www.marnen.org --~--~-~--~~~---~--~~ You received 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] Upgrade to Rails 2 - problem with "save" (MySQL boolean issue?)
I have been working through an upgrade of my 1.2.6 application to 2.2.2. I am almost there but I have hit a problem with ActiveRecord. Before the upgrade, the following code was working fine. def create_root(administrator) root = create_root_collection(self.pingee_name, administrator, GlobalAccessibility.new, OwnerAccessibility.new) root.save self.root = root end But now I get am getting an exception "undefined method `each' for true:TrueClass" when root.save is executed. fyi, the "create_root_collection" method creates a "root" object and assigns new object to its "belongs to" association. I have traced it through carefully and it is definitely failing when trying to save the "root" object itself. Given the error message, and the fact that the root object contains boolean columns, I wonder if the problem is to do with the saving boolean values. I am using MySQL and declaring the boolean columns in the following way (using raw SQL not migrations currently): include_parent_responses boolean default false not null, Is the "boolean" column type still valid? 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] paperclip plugins installation on netbeans
help pls i have trouble on installation of paperclip plugins on windows os.i'm using netbeans 6.5 , ruby 1.8.6,gems 1.2,rails 2.1,apache 2.2 and mysql. -- 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: uninitialized constant BooksController::Books
Newone One wrote: > hi new to rails ... > wat does it means... > uninitialized constant BooksController::Books > > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:102:in > `const_missing' > app/controllers/books_controller.rb:5:in `index' Most likely you have written Books.find instead of Book.find. -- 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: RoR deployment and maintenance
On Dec 18, 7:19 am, Fernando Perez wrote: [...] > An even better practice is to kick capistrano out, use a good scm such > as Mercurial, and roll your own deployment script. Why is that an "even better practice"? I find Capistrano extremely useful, even with Git (surely a "good scm"). I have indeed rolled my own deployment script -- in Capistrano. I don't see that a source- control system has anything directly to do with deployment (unless you want to get clever with commit hooks the way Heroku has, but while that works for Heroku, I'm not convinced that that's a particularly good idea in the general case). > > I'll have to give mod_rails a try one day, but I am still sure that > Nginx+Thin is the best setup. How can you be "sure" than Nginx + Thin is better than mod_rails if you haven't even tried mod_rails? Unlike any other Rails deployment option that I'm aware of, mod_rails makes deploying Rails apps as easy as deploying PHP apps, and performance appears to be excellent. What makes Nginx and Thin so excellent? Best, -- Marnen Laibow-Koser mar...@marnen.org http://www.marnen.org --~--~-~--~~~---~--~~ You received 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 setup - I'm losing it here.
OK so now we know you're using bash, substitute "echo" for "print" in my previous mail. Rick On Dec 19, 9:52 am, Ryan Ororie wrote: > Rick wrote: > > Hello Ryan, > > >> bio4054059:depot rmorourk$ mysql -uroot depot_development > >> -bash: mysql: command not found > > > "command not found" is your shell telling you that whatever directory > > you have installed mysql in to is not on your search path. > > > If you type "print $PATH" you will see a colon separated ordered list > > of directories that are searched for executable commands. To > > temporarily extend the list just type: set PATH=MYSQLHOME:$PATH where > > MYSQLHOME is the full path to the directory containing mysql > > executable. i.e. MSQLHOME might be /usr/local/mysql/bin. You should > > then be able to execute the mysql -uroot... command. > > > Once you have success with this, you should modify your shell startup > > file to make the PATH change permanent. Depending on what shell you > > use this could be .profile, .cshrc, .tshrc, ... > > > Rick > > Thanks, here is what I tried: > > bio4054059:~ rmorourk$ print $PATH > -bash: print: command not found > bio4054059:~ rmorourk$ set PATH=/Applications/MAMP/tmp/mysql/:$PATH > bio4054059:~ rmorourk$ mysql -uroot > -bash: mysql: command not found > > Any ideas? I'm using the default terminal on MAC OS X.. > > -- > 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: paperclip
Jean-Marc (M2i3.com) wrote: > Or you could try Ryan Bates screencast > > http://railscasts.com/episodes/134-paperclip > > Jean-Marc > http://m2i3.com > > On Dec 19, 12:23�am, Johny Johndoe thankz.I try it on linux os it works can you recommend another installation on windows os.I'm using netbeans 6.5, ruby 1.8.6,gems 1.2,rails 2.2,mysql. -- 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] uninitialized constant BooksController::Books
hi new to rails ... wat does it means... uninitialized constant BooksController::Books /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:102:in `const_missing' app/controllers/books_controller.rb:5:in `index' -- 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 duplicate "back" browser function in Rails?
On Dec 18, 10:57 pm, Ken Wagner wrote: [...] > Can this "back" browser function be invoked from a Rails "back" link? Sure: <%= link_to 'Back', '#', {}, :onclick => 'history.go(-1)' %> In most browsers, this will behave *exactly* like the Back button -- if the user has JavaScript turned on. > > TIA > > Ken Best, -- Marnen Laibow-Koser mar...@marnen.org http://www.marnen.org --~--~-~--~~~---~--~~ You received 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 newbie seek help with db indexing
Hi, I don't quite understand the syntax for database indexes and/or how the work to help speed up specific database searches. Can somebody suggest a set of indexs that would make this set of queries go faster? Contact Load (0.001406) SELECT * FROM `contacts` WHERE (`contacts`.user_id = 1) Phone Load (0.003268) SELECT * FROM `phones` WHERE (`phones`.contact_id = 8485) Email Load (0.000371) SELECT * FROM `emails` WHERE (`emails`.contact_id = 8485) Note Load (0.019782) SELECT * FROM `notes` WHERE (`notes`.contact_id = 8485) Group Load (0.000154) SELECT `groups`.* FROM `groups` INNER JOIN groupers ON groups.id = groupers.group_id WHERE ((`groupers`.contact_id = 8486)) a Contact has_many phones, emails, notes. a Contact has_many groups :through groupers Thanks much, and thanks even more if you include some explanation! thanks, jp -- 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: Processing uploaded XML file
Thanks for the info Simon. As far as the users waiting goes, thats easy... They will wait as long as I tell them to as long as I give them something to look at and a reason (Spinning CD and a "Please wait, Reticulating Splines" message perhaps). In fact the entire process isnt really a vital part of the program, it is simply to display some extra information for other users who may want to download it. So if that information was updated say 5 minutes later, it wouldnt really matter. In any event, I am having a look at starling and working to start a threaded process in the background and update the record whenever it finishes. If however libxml is as fast as you say, perhaps I simply need to do some load balancing and make them wait. Of course a major problem is that I still dont know where to call the processor from. Rails can be extremely frustrating when you are still learning it. Thanks for the info Simon Marc On Dec 20, 1:50 am, "Simon Macneall" wrote: > Hi Marc, > > Yes, the processing will block mongrel, but you should have more than one > mongrel (either using Passenger, or straight apache load balancing). The > bigger question is can your user wait 30 seconds for the response? There > are ways to run the process on a separate thread, but I haven't had to do > that yet. > > Yes, libXML is *much* faster than REXML. We are in the process of changing > our code, but the XML code is entwined so far through our app it is a big > job. > > Cheers > Simon > > On Sat, 20 Dec 2008 04:39:51 +0900, Marc wrote: > > > Hi all > > > Sorry if this seems silly, only been learning Ruby and Rails for 2 > > weeks, though I have been programming since the Commodore 64 came out. > > > I need to process an XML file once it is uploaded (currently using > > paperclip). > > The problem is that the files can be quite slow to process, up to 30 > > seconds for some. Once this processing is done, I need to save that > > data to the model to which the file is attached. > > > So my question is, where is the best place to call the processing > > function from? > > Will the processing block mongrel? Should it go in a new thread? If > > so, how do I do that? > > And is there any speedier Library than REXML for processing XML? > > > Thanks for your help > > Marc > > --~--~-~--~~~---~--~~ You received 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: HABTM 3 table relation
On Dec 19, 8:26 am, "Felipe Vergara" wrote: > Some help please!! > class Article < ActiveRecord::Base > has_and_belongs_to_many :tags, :join_table => :articles_tags_users [...] > user = User.new > tag = Tag.find(id) > article = Article.find(id) > user.tag << tag > user.article << article > > all this creates 2 tuples on the database articles_tags_users instead of one > with all the values > > Do somebody knows how to do this? I hope someone will correct me if I'm wrong, but I believe you will need to use has_many :through for this case -- HABTM isn't meant for 3- way joins as far as I know. You'll need something like this: class Article < ActiveRecord::Base has_many :correlations has_many :tags, :through => :correlations has_many :users, :through => :correlations end (similarly for User and Tag) class Correlation < ActiveRecord::Base belongs_to :article belongs_to :tag belongs_to :user end Then your sample controller code would become something like user = User.new tag = Tag.find(id) article = Article.find(id) user.correlations << Correlation.new(:tag => tag, :article => article) Does that help? Best, -- Marnen Laibow-Koser mar...@marnen.org http://www.marnen.org --~--~-~--~~~---~--~~ You received 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: Issues With New Site
On Dec 19, 1:06 pm, Rob Pa wrote: > Hi, > > I am using Ruby on Rails to create a new site. > > On every page, I want to have a log in box. I also want to display the > latest 5 news items on all the pages as well. > > How could I go around this? You would probably want to put these elements in your layout, rather than in each individual view. > Is it possible to have @news = > News.find(:all, :limit => 5 ) in the application handler, and then call > the @news on all pages? You could do this, but it would probably be easier and more maintainable to use a partial. > > Would I also be able to handle the log in code in the main application > controller aswell? Yes. See restful_authentication for a very nice login plugin (I use it on most of my apps). > > Thanks a lot, > Rob Best, -- Marnen Laibow-Koser mar...@marnen.org http://www.marnen.org --~--~-~--~~~---~--~~ You received 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: Noob - added a column via migration but get error on insert
On Dec 19, 3:51 pm, "Brian A." wrote: > Thanks! That did the trick. So anytime I make a DB modification and am > working via the console I need to restart it so it will become aware of > the changes. Very interesting. I believe you can also type app.reload! in the console. Also, as you go forward with Rails, you might want to consider giving jEdit a try as an IDE. It's powerful, but much easier to work with for Rails than are "heavier" programs like NetBeans or Eclipse. See http://marnen.livejournal.com/23723.html for more info on configuring jEdit. Best, -- Marnen Laibow-Koser mar...@marnen.org http://www.marnen.org --~--~-~--~~~---~--~~ You received 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: upload image
You could try Paperclip: http://www.thoughtbot.com/projects/paperclip On 20/12/2008, at 4:07 PM, Johny ben wrote: > > anyone have a code that upload image > -- > 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: undefined method `stories_path'
Glad to help. I assume you're following the SitePoint Rails book? It's a good one – it helped me learn Rails when I was starting out (I got the free copy for Rails 2.1) -- Bryce Roney On 20/12/2008, at 3:36 PM, Merrick Johnson wrote: > > Bryce Roney wrote: >> Is your config/routes.rb properly set up? >> >> -- Bryce Roney > > Aha, fixed. Yea thanks for the tip, completely overlooked mapping the > resource. The solution was: > > map.resources :stories > -- > 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: rake aborted (wrong number of arguments)
What does 001_create_products.rb look like? (BTW, if your migration filenames look like that, your tutorial may be for an older version of Rails. If you use script/generate migration, newer versions of Rails will use a timestamp, so that the filename might be something like 20081217040235_create_products.rb . That's not a big deal in itself -- either naming scheme will work -- but it *does* imply that you may be using a slightly outdated tutorial.) Best, -- Marnen Laibow-Koser mar...@marnen.org http://www.marnen.org --~--~-~--~~~---~--~~ You received 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't get RedCloth to work properly with markitup
For some reason RedCloth isn't parsing things up properly. For some reason it doesn't end the header tags on line breaks. I am using RedCloth 3.0.4 and markitup is set to insert \n\n when enter is clicked. Is there something that I am missing? 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] upload image
anyone have a code that upload image -- 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: Ultrasphinx: adding field_name in search query
Veera Sundaravel wrote: > Hi all, > > I want to search for a keyword in a particular field, for example say I > want to search for the keyword "rails" in the field title so how can I > include the field_name in query string. > > s=Ultrasphinx::Search.new(:query => "@title rails") > > or > > s=Ultrasphinx::Search.new(:query => "title: rails") > > or > > s=Ultrasphinx::Search.new(:query => "@title: rails") > > > Thanks in advance, > T.Veeraa. finally I found s=Ultrasphinx::Search.new(:query => "title: rails") above is the write syntax to include the field_name inside search query as per the documentation. But when you are using this for exact phrase match, it not working. s=Ultrasphinx::Search.new(:query => 'title: "ruby on rails"') am searching for the exact phrase "ruby on rails" in title field it matches exact phrase, thats good, but when am trying the same phrase with another field also returning the same result. Hence not its not looking into the field what I specified. -- 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: undefined method `stories_path'
Bryce Roney wrote: > Is your config/routes.rb properly set up? > > -- Bryce Roney Aha, fixed. Yea thanks for the tip, completely overlooked mapping the resource. The solution was: map.resources :stories -- 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: undefined method `stories_path'
Is your config/routes.rb properly set up? -- Bryce Roney On 20/12/2008, at 3:27 PM, Merrick Johnson wrote: > > Hi, > > I recieve error "undefined method `stories_path' for > #" when going to the view via > site.com/stories/new > > The model is setup correctly, I can retrieve data from the db fine. I > think it might be related to the helper but I have no idea where to > start. It seems to think its failing on the first line of the view, i > belive on the 'form_for' method. > > heres the traceback: > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in > `__send__' > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in > `polymorphic_url' > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:119:in > `polymorphic_path' > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:269:in > `apply_form_for_options!' > /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/ > actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:248:in > `form_for' > /var/www/html/railsapps/shovell/dev/app/views/stories/new.html.erb:1 > > controller: > > class StoriesController < ApplicationController > def index >@story = Story.find_by_name('SitePoint Forums') > end > def new >@story = Story.new > end > end > > > view: > > <% form_for @story do |f| %> > > name: > <%= f.text_field :name %> > > > link: > <%= f.text_field :link %> > > > <%= submit_tag %> > > <% 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] undefined method `stories_path'
Hi, I recieve error "undefined method `stories_path' for #" when going to the view via site.com/stories/new The model is setup correctly, I can retrieve data from the db fine. I think it might be related to the helper but I have no idea where to start. It seems to think its failing on the first line of the view, i belive on the 'form_for' method. heres the traceback: /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in `__send__' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in `polymorphic_url' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:119:in `polymorphic_path' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:269:in `apply_form_for_options!' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:248:in `form_for' /var/www/html/railsapps/shovell/dev/app/views/stories/new.html.erb:1 controller: class StoriesController < ApplicationController def index @story = Story.find_by_name('SitePoint Forums') end def new @story = Story.new end end view: <% form_for @story do |f| %> name: <%= f.text_field :name %> link: <%= f.text_field :link %> <%= submit_tag %> <% 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: Changing a column name with migration failed
My earlier statement, "I don't have a column name" is incorrect. The statement: rename_column(:csvs, :created, :accessed) provided the table_name "cvs" as symbol, the old_name "created" as a symbol, and the new_name. So I don't have a clue as to what's wrong. All the code is on http://www.pastie.org/343735, as I mentioned before. Again, thanks for any insights you may offer, Richard On Dec 19, 11:01 pm, RichardOnRails wrote: > BTW, I put up all the code onhttp://www.pastie.org/343735 > > HTH, > Richard > > On Dec 19, 10:51 pm, RichardOnRails > > wrote: > > Hi All, > > > I had a column-name "changed" that I wanted to replaced with > > "accessed". > > > I tried: > > class ModifyChangedAttribute < ActiveRecord::Migration > > def self.up > > rename_column(:csvs, :created, :accessed) > > end > > > def self.down > > rename_column(:csvs, :accessed, :created) > > end > > end > > > The migration failed: > > 1. It was apparent because rake db/migrate returned only one line > > indicating the app's "home" > > 2. Sqlite3's .dump table_name showed that "created" was unchanged. > > > I see now that I provided no table_name to the migration. How do I do > > that? > > > I'm running: > > ruby 1.8.6 > > Rails 2.2.1 > > Win-Pro/SP3 > > > Thanks in Advance, > > Richard --~--~-~--~~~---~--~~ You received 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: When to use #show action in RESTful application
Very cool. Thank you, I will watch for updates! On Dec 19, 6:17 pm, Ryan Bigg wrote: > Rboard can be found athttp://gitpilot.co > - > Ryan Bigg > Freelancerhttp://frozenplague.net > > On 20/12/2008, at 11:40 AM, jasoo24 wrote: > > > > > For my admin pages, I always use the edit action instead of show. It > > cuts down on the amount of work and I find it more useful that way. > > > Hey Ryan, do you have any live rboards up on the web? I'd love to see > > it in action... > > > On Dec 17, 7:22 pm, "Patrick Doyle" wrote: > >> I am curious what folks do with the #show action (and its > >> associated view) > >> in a RESTful application. > > >> How often is it used? > > >> It seems to me that, for the sorts of applications I can envision, it > >> probably wouldn't be used much at all. Everything I might want to > >> show can > >> be displayed by the #index action. Is that true more or less often > >> than > >> not? > > >> If there isn't anything to be gained by a #show action, what do > >> folks do (if > >> anything) to disable it? > > >> I have seen a use for #show in the classic case of a blog, where > >> the index > >> page shows the titles of each of the entries in the blog, but the > >> user must > >> click on one of those titles to "show" the actual blog post, but > >> that brings > >> up a related (and nearly identical) question... > > >> I can see the same issue with the #new action for a nested route. > >> Again in > >> the classic blog application, the #show action for the post would > >> probably > >> include a form for adding a comment, thus eliminating the need for > >> a #new > >> action (and its view) . > > >> What do you folks with vastly more RoR experience than I do in these > >> situations? Is there a best practice? Is there a common practice? > > >> --wpd --~--~-~--~~~---~--~~ You received 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] rake aborted (wrong number of arguments)
I'm following a tutorial here to get some columns in my database. I generated a model called 'product' then I edited 'db/001_create_products.rb' to have a few columns but when I try to migrate I get this error: bio4054059:depot rmorourk$ rake db:migrate (in /Users/rmorourk/Sites/depot) == CreateProducts: migrating == -- create_table(:products) rake aborted! wrong number of arguments (1 for 2) (See full trace by running task with --trace) bio4054059:depot rmorourk$ I copied the code exactly for the 001_create_products.rb not really sure what it means by wrong number of arguments... any advise would be welcomed happily! -- 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: Changing a column name with migration failed
BTW, I put up all the code on http://www.pastie.org/343735 HTH, Richard On Dec 19, 10:51 pm, RichardOnRails wrote: > Hi All, > > I had a column-name "changed" that I wanted to replaced with > "accessed". > > I tried: > class ModifyChangedAttribute < ActiveRecord::Migration > def self.up > rename_column(:csvs, :created, :accessed) > end > > def self.down > rename_column(:csvs, :accessed, :created) > end > end > > The migration failed: > 1. It was apparent because rake db/migrate returned only one line > indicating the app's "home" > 2. Sqlite3's .dump table_name showed that "created" was unchanged. > > I see now that I provided no table_name to the migration. How do I do > that? > > I'm running: > ruby 1.8.6 > Rails 2.2.1 > Win-Pro/SP3 > > Thanks in Advance, > Richard --~--~-~--~~~---~--~~ You received 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] Changing a column name with migration failed
Hi All, I had a column-name "changed" that I wanted to replaced with "accessed". I tried: class ModifyChangedAttribute < ActiveRecord::Migration def self.up rename_column(:csvs, :created, :accessed) end def self.down rename_column(:csvs, :accessed, :created) end end The migration failed: 1. It was apparent because rake db/migrate returned only one line indicating the app's "home" 2. Sqlite3's .dump table_name showed that "created" was unchanged. I see now that I provided no table_name to the migration. How do I do that? I'm running: ruby 1.8.6 Rails 2.2.1 Win-Pro/SP3 Thanks in Advance, Richard --~--~-~--~~~---~--~~ You received 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 setup - I'm losing it here.
Ryan Ororie wrote: >> What you really want is: >> /Applications/MAMP/Library/bin/mysqladmin -u root -p root create >> depot_development >> > > Interesting, thanks... but now I am getting a problem with the password. > Observe: > > bio4054059:depot rmorourk$ /Applications/MAMP/Library/bin/mysqladmin -u > root -p root create depot_development > Enter password: > /Applications/MAMP/Library/bin/mysqladmin: Unknown command: 'root' > bio4054059:depot rmorourk$ > > When prompted for the password I typed root - which is what the password > is (at least in the database.yml file) but it gives me an unknown > command output? > > > > Rather inconsistently there should be a space between the -u and the username but there must not be a space between the -p and the password. an alternative is to use: mysqladmin --user=root --password=root create depot_development notice the double minus on the options in this form. man mysqladmin will give you information on the options and usage of the command. Norm --~--~-~--~~~---~--~~ You received 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: Which Sphinx Plugin?
On Sat, Dec 20, 2008 at 1:12 AM, tashfeen.ekram wrote: > > anyone know if any of these sphinx plugins automatically updates ones > index without having to do it oneself. > > looking into sphinx apparently you have tell sphinx to re-index with a > rake command. > That's how Sphinx itself works, you won't find any plugins that update an index every time a model is updated ('cos it isn't really a good idea). If you really need live updates, you should consider using Solr and the acts_as_solr plugin. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Which Sphinx Plugin?
anyone know if any of these sphinx plugins automatically updates ones index without having to do it oneself. looking into sphinx apparently you have tell sphinx to re-index with a rake command. On Dec 18, 1:01 pm, "tashfeen.ekram" wrote: > here is what i am apeficlaly trying to do: > > I am creating a databse of some data i have gotten as a flat file. i > have about 2K entries each tagged with tags anywhere between 1 to 7. > There are probably a total of about 50 different type of tags. Write > now my data is flat and not in a relational db. i want to be able to > allow people to surface what products when they are looking at one > paritcular product are related to it based on all the things that one > product is tagged with. i am thinking of being lazy and just diong > text search of the tag field and then aprsing out all of the tags and > making queries to find all of the oher items with that tag. i could of > course make the db relational which make searh faster. given i only > have about 2k items, it seems likesphinxwill be fast enough to have > to avoid playing with the data i have. > > it does not seem like i need asphinxplugin with all of the bells and > whistle to do teh above. it seems like thinkingsphinxwill do the > job. thoguhts? > > On Dec 18, 2:24 am, Danny Burkes > wrote: > > > At Rejaw (http://rejaw.com), we are using Ultrasphinx, with great > > success. It's a little more difficult to configure than Thinking > >Sphinx, but it's also more flexible, and we needed that flexibility. > > -- > > 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: mySQL setup - I'm losing it here.
> What you really want is: > /Applications/MAMP/Library/bin/mysqladmin -u root -p root create > depot_development Interesting, thanks... but now I am getting a problem with the password. Observe: bio4054059:depot rmorourk$ /Applications/MAMP/Library/bin/mysqladmin -u root -p root create depot_development Enter password: /Applications/MAMP/Library/bin/mysqladmin: Unknown command: 'root' bio4054059:depot rmorourk$ When prompted for the password I typed root - which is what the password is (at least in the database.yml file) but it gives me an unknown command output? -- 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: mySQL setup - I'm losing it here.
Ryan Ororie wrote: >> So based on this here is what I've done. It seems to be creating the >> database but then the rake command is saying there is no such database? >> >> bio4054059:depot rmorourk$ /Applications/MAMP/Library/bin/mysql >> mysqladmin -u root -p root create depot_development >> >> /Applications/MAMP/Library/bin/mysql Ver 14.12 Distrib 5.0.41, for >> apple-darwin8.11.1 (i686) using EditLine wrapper >> Copyright (C) 2002 MySQL AB >> This software comes with ABSOLUTELY NO WARRANTY. This is free software, >> and you are welcome to modify and redistribute it under the GPL license >> Usage: /Applications/MAMP/Library/bin/mysql [OPTIONS] [database] >> Whenever you see a message starting "Usage:" it means you did not give the correct options and the program will then go on and tell you what the options really are (in this case in a lot of detail). You in this case entered the wrong command: You apparently entered: /Applications/MAMP/Library/bin/mysql mysqladmin -u root -p root create depot_development and correctly got an error message from mysql telling you that the options were all screwed up. What you really want is: /Applications/MAMP/Library/bin/mysqladmin -u root -p root create depot_development This will probably work and give you no output message (most Unix/Linux commands are silent on success). Mysqladmin is a standalone command not a subcommand of mysql. You probably should not have to enter the full pathname but it will work. Norm --~--~-~--~~~---~--~~ You received 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] Help with nested models and fields_for
Hi folks. I'm trying to do stuff with models nested one layer deeper than I've done in the past...and it's just not working properly. Here's the situation: * I have three models involved here: Recipe, IngredientLine, and Ingredient (it's a cookbook application). class Recipe < ActiveRecord::Base has_many :ingredient_lines has_many :ingredients, :through => :ingredient_lines end class IngredientLine < ActiveRecord::Base belongs_to :ingredient belongs_to :recipe end class Ingredient < ActiveRecord::Base has_many :ingredient_lines has_many :recipes, :through => :ingredient_lines end * I'm trying to develop a form which edits a Recipe along with its associated IngredientLines and Ingredients. Right now, I've been working with this sort of thing (it's a Facebook app, hence the .fbml extension, and I'm only doing relevant excerpts so as not to take up too much space here): --- recipe/views/new.fbml.haml --- - form_for(@current_object) do |f| = f.text_field :name = render :partial => 'ingredient', :locals => {:f => f} = f.text_area :instructions --- recipe/views/_ingredient.fbml.haml --- - f.fields_for :ingredient_lines, :index => nil do |ff| %td= ff.text_field :quantity, :size => 3, :maxlength => 3, :id => nil %td= ff.text_field :unit, :id => nil - ff.fields_for :ingredient do |i| %td= i.text_field :name, :id => nil * I've tried this with fields_for instead of f.fields_for as well. * There's some JavaScript to produce multiple copies of the partial for multiple ingredient, but I'm omitting that since it's not relevant here. * The HTML/FBML output for this is as expected: So far so good. But here's the problem: *submissions don't work quite properly*. When I fill out the form and submit it, I get params entries like "recipe"=>{"name"=>"Recipe", "ingredient_lines"=>[{"quantity"=>"1", "unit"=>"cup", "ingredient"=>{}}], "instructions"=>"Preheat oven to 350°..."}. Note that ingredient_lines[0].ingredient.name is missing, even if I enter text in the corresponding form field -- in other words, what I should be seeing is something like "recipe"=> {"name"=>"Recipe", "ingredient_lines"=>[{"quantity"=>"1", "unit"=>"cup", "ingredient"=>{"name" => "flour"}}], "instructions"=>"Preheat oven to 350°..."}. What am I doing wrong? Any suggestions would be helpful. Thanks in advance! Best, -- Marnen Laibow-Koser mar...@marnen.org http://www.marnen.org --~--~-~--~~~---~--~~ You received 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: When to use #show action in RESTful application
Rboard can be found at http://gitpilot.co - Ryan Bigg Freelancer http://frozenplague.net On 20/12/2008, at 11:40 AM, jasoo24 wrote: > > For my admin pages, I always use the edit action instead of show. It > cuts down on the amount of work and I find it more useful that way. > > Hey Ryan, do you have any live rboards up on the web? I'd love to see > it in action... > > On Dec 17, 7:22 pm, "Patrick Doyle" wrote: >> I am curious what folks do with the #show action (and its >> associated view) >> in a RESTful application. >> >> How often is it used? >> >> It seems to me that, for the sorts of applications I can envision, it >> probably wouldn't be used much at all. Everything I might want to >> show can >> be displayed by the #index action. Is that true more or less often >> than >> not? >> >> If there isn't anything to be gained by a #show action, what do >> folks do (if >> anything) to disable it? >> >> I have seen a use for #show in the classic case of a blog, where >> the index >> page shows the titles of each of the entries in the blog, but the >> user must >> click on one of those titles to "show" the actual blog post, but >> that brings >> up a related (and nearly identical) question... >> >> I can see the same issue with the #new action for a nested route. >> Again in >> the classic blog application, the #show action for the post would >> probably >> include a form for adding a comment, thus eliminating the need for >> a #new >> action (and its view) . >> >> What do you folks with vastly more RoR experience than I do in these >> situations? Is there a best practice? Is there a common practice? >> >> --wpd > > --~--~-~--~~~---~--~~ You received 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: Spam in my comments
acts_as_snook is great for capturing stuff like that: http://github.com/rsl/acts_as_snook - Ryan Bigg Freelancer http://frozenplague.net On 20/12/2008, at 9:14 AM, Maurício Linhares wrote: > > For what? A link? > > Your user could paste a link. > > There's no easy way to tell that a comment is a spam (you would need a > tool to perform analysis on the comment content to mark it as spam, > that's exactly what tools like Askimet do). > > - > Maurício Linhares > http://alinhavado.wordpress.com/ (pt-br) | http:// > blog.codevader.com/ (en) > > > > On Fri, Dec 19, 2008 at 7:42 PM, bingo bob > wrote: >> >> >> OK but what about just validation statements in the models? >> >> Can I do it like that, maybe screening for some regex's ? >> -- >> 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: mySQL setup - I'm losing it here.
> set PATH=Applications/MAMP/Library/bin:$PATH > > should be > > set PATH=/Applications/MAMP/Library/bin:$PATH > > looks like it's there and even without setting the path you should be > able to do: > > /Applications/MAMP/Library/bin/mysql -u root So based on this here is what I've done. It seems to be creating the database but then the rake command is saying there is no such database? bio4054059:depot rmorourk$ /Applications/MAMP/Library/bin/mysql mysqladmin -u root -p root create depot_development /Applications/MAMP/Library/bin/mysql Ver 14.12 Distrib 5.0.41, for apple-darwin8.11.1 (i686) using EditLine wrapper Copyright (C) 2002 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Usage: /Applications/MAMP/Library/bin/mysql [OPTIONS] [database] -?, --help Display this help and exit. -I, --help Synonym for -? --auto-rehash Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash. -A, --no-auto-rehash No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead. -B, --batch Don't use history file. Disable interactive behavior. (Enables --silent) --character-sets-dir=name Directory where character sets are. --default-character-set=name Set the default character set. -C, --compress Use compression in server/client protocol. -#, --debug[=#] This is a non-debug version. Catch this and exit -D, --database=name Database to use. --delimiter=nameDelimiter to be used. -e, --execute=name Execute command and quit. (Disables --force and history file) -E, --vertical Print the output of a query (rows) vertically. -f, --force Continue even if we get an sql error. -G, --named-commands Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default. -g, --no-named-commands Named commands are disabled. Use \* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead. -i, --ignore-spaces Ignore space after function names. --local-infile Enable/disable LOAD DATA LOCAL INFILE. -b, --no-beep Turn off beep on error. -h, --host=name Connect to host. -H, --html Produce HTML output. -X, --xml Produce XML output --line-numbers Write line numbers for errors. -L, --skip-line-numbers Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead. -n, --unbufferedFlush buffer after each query. --column-names Write column names in results. -N, --skip-column-names Don't write column names in results. WARNING: -N is deprecated, use long version of this options instead. -O, --set-variable=name Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value. --sigint-ignore Ignore SIGINT (CTRL-C) -o, --one-database Only update the default database. This is useful for skipping updates to other database in the update log. --pager[=name] Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\h) also. This option does not work in batch mode. Disable with --disable-pager. This option is disabled by default. --no-pager Disa
[Rails] Re: help with counter_cache
Scott Kulik wrote: > Scott Kulik wrote: >> Sazima wrote: >>> Maybe s.items.count is zero? >>> >>> Cheers, Sazima >>> >>> On Dec 19, 5:01�am, Scott Kulik >> >> hmm...it shouldn't be since @user.items.count in my view shows the count >> correctly for each user. > > is there another i can do it like this but not using a migration? > > i tried to create a rake task but that didn't work. here is my rake > task: > > sku...@kuliksco-ub:/u1/app/wldev/lib/tasks$ cat update_items_count.rake > task :updateItemsCount do > User.find(:all) do |u| > u.update_attribute :items_count, s.items.count > end > end > > sku...@kuliksco-ub:/u1/app/wldev/lib/tasks$ rake updateItemsCount > (in /u1/app/wldev) > rake aborted! > uninitialized constant User > > (See full trace by running task with --trace) > > thanks! got it. i had to do this: task(:updateItemsCount => :environment) do User.find(:all).each do |u| u.update_attribute :items_count, u.items.count end end it's still not working but at least i can test easier! -- 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: When to use #show action in RESTful application
For my admin pages, I always use the edit action instead of show. It cuts down on the amount of work and I find it more useful that way. Hey Ryan, do you have any live rboards up on the web? I'd love to see it in action... On Dec 17, 7:22 pm, "Patrick Doyle" wrote: > I am curious what folks do with the #show action (and its associated view) > in a RESTful application. > > How often is it used? > > It seems to me that, for the sorts of applications I can envision, it > probably wouldn't be used much at all. Everything I might want to show can > be displayed by the #index action. Is that true more or less often than > not? > > If there isn't anything to be gained by a #show action, what do folks do (if > anything) to disable it? > > I have seen a use for #show in the classic case of a blog, where the index > page shows the titles of each of the entries in the blog, but the user must > click on one of those titles to "show" the actual blog post, but that brings > up a related (and nearly identical) question... > > I can see the same issue with the #new action for a nested route. Again in > the classic blog application, the #show action for the post would probably > include a form for adding a comment, thus eliminating the need for a #new > action (and its view) . > > What do you folks with vastly more RoR experience than I do in these > situations? Is there a best practice? Is there a common practice? > > --wpd --~--~-~--~~~---~--~~ You received 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: help with counter_cache
Scott Kulik wrote: > Sazima wrote: >> Maybe s.items.count is zero? >> >> Cheers, Sazima >> >> On Dec 19, 5:01�am, Scott Kulik > > hmm...it shouldn't be since @user.items.count in my view shows the count > correctly for each user. is there another i can do it like this but not using a migration? i tried to create a rake task but that didn't work. here is my rake task: sku...@kuliksco-ub:/u1/app/wldev/lib/tasks$ cat update_items_count.rake task :updateItemsCount do User.find(:all) do |u| u.update_attribute :items_count, s.items.count end end sku...@kuliksco-ub:/u1/app/wldev/lib/tasks$ rake updateItemsCount (in /u1/app/wldev) rake aborted! uninitialized constant User (See full trace by running task with --trace) 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: mySQL setup - I'm losing it here.
I think set PATH=Applications/MAMP/Library/bin:$PATH should be set PATH=/Applications/MAMP/Library/bin:$PATH looks like it's there and even without setting the path you should be able to do: /Applications/MAMP/Library/bin/mysql -u root hope that helps Tim On Dec 19, 3:46 pm, Ryan Ororie wrote: > > I'd imagine that somewhere under /Applications/MAMP is a directory > > with a bunch of files with names starting with mysql. Look around, or > > run this from a prompt: > > So I found the folder (who's contents I am going to list in my output in > a second) with all the files starting with mysql. It is located here: > Applications/MAMP/Library/bin - Here is what an ls of the dir revealed: > > bio4054059:bin rmorourk$ ls > ab mysql_convert_table_format > apachectl mysql_explain_log > apr-config mysql_find_rows > apu-config mysql_fix_extensions > apxs mysql_fix_privilege_tables > autopoint mysql_install_db > checkgid mysql_secure_installation > cjpeg mysql_setpermission > comp_err mysql_tableinfo > curl mysql_tzinfo_to_sql > curl-config mysql_upgrade > dbmmanage mysql_upgrade_shell > djpeg mysql_waitpid > envsubst mysql_zap > envvars mysqlaccess > envvars-std mysqladmin > freetype-config mysqlbinlog > gettext mysqlbug > gettext.sh mysqlcheck > gettextize mysqld_multi > htdbm mysqld_safe > htdigest mysqldump > htpasswd mysqldumpslow > httpd mysqlhotcopy > httxt2dbm mysqlimport > iconv mysqlshow > idn mysqltest > innochecksum mysqltestmanager > jpegtran mysqltestmanager-pwgen > libmcrypt-config mysqltestmanagerc > libpng-config ngettext > libpng12-config perror > libtool rdjpgcom > libtoolize recode-sr-latin > logresolve replace > msgattrib resolve_stack_dump > msgcat resolveip > msgcmp rotatelogs > msgcomm sabcmd > msgconv sablot-config > msgen type1afm > msgexec wrjpgcom > msgfilter xgettext > msgfmt xml2-config > msggrep xmlcatalog > msginit xmllint > msgmerge xslt-config > msgunfmt xsltproc > msguniq yaz-asncomp > msql2mysql yaz-client > my_print_defaults yaz-config > myisam_ftdump yaz-iconv > myisamchk yaz-icu > myisamlog yaz-illclient > myisampack yaz-marcdump > mysql yaz-ztest > mysql_client_test zoomsh > mysql_config > > Assuming this was what I had been searching for, I did this: > > bio4054059:bin rmorourk$ echo $PATH > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin:/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/sbin:/Users/rmorourk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: > bio4054059:bin rmorourk$ set PATH=Applications/MAMP/Library/bin:$PATH > bio4054059:bin rmorourk$ cd .. .. .. .. .. .. > bio4054059:Library rmorourk$ cd .. > bio4054059:MAMP rmorourk$ cd .. > bio4054059:Applications rmorourk$ cd .. > bio4054059:/ rmorourk$ cd Users/rmorourk/Sites/depot/ > bio4054059:depot rmorourk$ mysqladmin -u root create depot_devdb > -bash: mysqladmin: command not found > bio4054059:depot rmorourk$ mysql -U > -bash: mysql: command not found > bio4054059:depot rmorourk$ > > As you can see the mysql command still isn't found, any thoughts? I feel > like we are getting closer. Thanks for the help thus far!! > -- > 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: Processing uploaded XML file
Hi Marc, Yes, the processing will block mongrel, but you should have more than one mongrel (either using Passenger, or straight apache load balancing). The bigger question is can your user wait 30 seconds for the response? There are ways to run the process on a separate thread, but I haven't had to do that yet. Yes, libXML is *much* faster than REXML. We are in the process of changing our code, but the XML code is entwined so far through our app it is a big job. Cheers Simon On Sat, 20 Dec 2008 04:39:51 +0900, Marc wrote: > > Hi all > > Sorry if this seems silly, only been learning Ruby and Rails for 2 > weeks, though I have been programming since the Commodore 64 came out. > > I need to process an XML file once it is uploaded (currently using > paperclip). > The problem is that the files can be quite slow to process, up to 30 > seconds for some. Once this processing is done, I need to save that > data to the model to which the file is attached. > > So my question is, where is the best place to call the processing > function from? > Will the processing block mongrel? Should it go in a new thread? If > so, how do I do that? > And is there any speedier Library than REXML for processing XML? > > Thanks for your help > Marc > > --~--~-~--~~~---~--~~ You received 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 setup - I'm losing it here.
> I'd imagine that somewhere under /Applications/MAMP is a directory > with a bunch of files with names starting with mysql. Look around, or > run this from a prompt: So I found the folder (who's contents I am going to list in my output in a second) with all the files starting with mysql. It is located here: Applications/MAMP/Library/bin - Here is what an ls of the dir revealed: bio4054059:bin rmorourk$ ls abmysql_convert_table_format apachectl mysql_explain_log apr-config mysql_find_rows apu-config mysql_fix_extensions apxsmysql_fix_privilege_tables autopoint mysql_install_db checkgid mysql_secure_installation cjpegmysql_setpermission comp_err mysql_tableinfo curlmysql_tzinfo_to_sql curl-config mysql_upgrade dbmmanage mysql_upgrade_shell djpegmysql_waitpid envsubst mysql_zap envvarsmysqlaccess envvars-std mysqladmin freetype-config mysqlbinlog gettextmysqlbug gettext.sh mysqlcheck gettextize mysqld_multi htdbmmysqld_safe htdigest mysqldump htpasswd mysqldumpslow httpdmysqlhotcopy httxt2dbm mysqlimport iconvmysqlshow idnmysqltest innochecksum mysqltestmanager jpegtran mysqltestmanager-pwgen libmcrypt-configmysqltestmanagerc libpng-config ngettext libpng12-config perror libtoolrdjpgcom libtoolize recode-sr-latin logresolve replace msgattrib resolve_stack_dump msgcatresolveip msgcmprotatelogs msgcommsabcmd msgconvsablot-config msgentype1afm msgexecwrjpgcom msgfilter xgettext msgfmtxml2-config msggrepxmlcatalog msginitxmllint msgmerge xslt-config msgunfmt xsltproc msguniqyaz-asncomp msql2mysql yaz-client my_print_defaultsyaz-config myisam_ftdump yaz-iconv myisamchk yaz-icu myisamlog yaz-illclient myisampack yaz-marcdump mysqlyaz-ztest mysql_client_testzoomsh mysql_config Assuming this was what I had been searching for, I did this: bio4054059:bin rmorourk$ echo $PATH /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin:/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/sbin:/Users/rmorourk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: bio4054059:bin rmorourk$ set PATH=Applications/MAMP/Library/bin:$PATH bio4054059:bin rmorourk$ cd .. .. .. .. .. .. bio4054059:Library rmorourk$ cd .. bio4054059:MAMP rmorourk$ cd .. bio4054059:Applications rmorourk$ cd .. bio4054059:/ rmorourk$ cd Users/rmorourk/Sites/depot/ bio4054059:depot rmorourk$ mysqladmin -u root create depot_devdb -bash: mysqladmin: command not found bio4054059:depot rmorourk$ mysql -U -bash: mysql: command not found bio4054059:depot rmorourk$ As you can see the mysql command still isn't found, any thoughts? I feel like we are getting closer. Thanks for the help thus far!! -- 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] Best way to edit associated models?
What is a good way to edit associated models? I am continuing a work project started by another. The schema doesn't seem unreasonable. But it is pre-existing and I don't yet have a reason to change it. For example: Location belongs_to Company Workshop belongs_to Company Workshop belongs_to Location Workshop belongs_to Questionnaire Company has_one Locations Company has_many Workshops Location has_many Workshops Questionnaire has_many Workshops I want to edit a Workshop training class. This has a company attached to it and through it has a location and a questionnaire attached to it. If I want to edit one of the associated models, such as to change the company name, is it reasonable to want to edit it in place with the rest of the workshop model? Generally here the relationship is one to one most of the time. Or is it better to force the data model on the editor and require them to edit each model on its own page? Is the data schema always forced upon the interface? If this is strictly a one to one relationship does that change things? I want to edit a Company. This has a Location attached to it. If I want to edit the location must I force the user to edit the location on a dedicated page interface and then back to the Company edit page? You can see the issue I am working though. General thoughts or recommendations here? Any good examples that you can point to? Thanks Bob --~--~-~--~~~---~--~~ You received 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: Ruby vs. RubyOnRails compatibility matrix ?
Hi Jodi, > avoid 1.8.7 if you're < rails 2.2 - > I had a number of problems (today) - thanks for sharing this - I'm very sorry for your issues. Maybe having some kind of community integration server to cross test the various builds would be useful. Did anyone do this already ? cheers Thibaut Barrère --~--~-~--~~~---~--~~ You received 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: Setting a CSS class on select helper
Oh yeah! That's much cleaner. Thanks for the reply. -- 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] Validator not quite working
Hi guys, I'm trying to get the form validator to work - and it almost does. What happens, I believe, is that it throws the error properly, but it never makes it back to the page to post the error. Instead, it kind of blows up. I used the same basic code the scaffold uses, so I'm not sure why it's not working. If you guys wouldn't mind... controller = Signups, model = Customer Cheers. And thanks in advance! The error message: http://farm4.static.flickr.com/3259/3120802163_cefc0d789f_o.jpg SignupsController http://www.pastie.org/343627 Index View http://www.pastie.org/343631 Customer model class Customer < ActiveRecord::Base validates_presence_of :first_name, :last_name, :email 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: Setting a CSS class on select helper
Dan Weaver wrote: > Hi, > > I'm trying to put a css class on a dropdown box built using a select > helper (to make it wider) but I can't get it to take. I thought for > sure, and from what I've seen elsewhere, this code should work: > > <%= f.select :month, 1..12, :selected => Time.now.month.to_i, :class => > 'monthSelect' %> You have to make sure Ruby sees two separate hash arguments: <%= f.select :month, 1..12, {:selected => Time.now.month.to_i}, :class => 'monthSelect' %> -- 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: Ruby vs. RubyOnRails compatibility matrix ?
avoid 1.8.7 if you're < rails 2.2 - I had a number of problems (today) - On 19-Dec-08, at 5:37 PM, Thibaut Barrère wrote: > > Hi Rob, > >> Well, since I know that Rails 1.1.6 and 1.2.2 application will run >> fine under Ruby 1.8.6 (and 1.8.5), I'll start you with that. There's >> plenty of evidence that Ruby 1.8.7 is more of a prequel to 1.9 than >> an >> upgrade to 1.8.6 so you'll have to collect your own evidence about >> older Rails running on Ruby 1.8.7. > > Thanks for your feedback on 1.1.6 and 1.2.2. > > I'll start by upgrading to 1.8.6, seems like a pretty good candidate. > > thanks! > > -- Thibaut > > --~--~-~--~~~---~--~~ You received 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: Setting a CSS class on select helper
I got it to work using: <%= options_for_select(1..12, Time.now.month.to_i) %> Just curious, though, is that the only way to add a css class to that type of 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: database.yml and .gitignore
Very helpful. Thanks guys! On Dec 11, 2:12 pm, James Byrne wrote: > Jeff Cohen wrote: > > > If it got added to your git repo before you specified it in the ignore > > file, I think you have to remove it: > > > git rm config/database.yml > > git commit -a -m "Removed database.yml" > > > (maybe save a backup of your database.yml first :-) > > > Jeff > > Safer I think to: > > # git status > # git rm config/database.yml --cache > > --cache should leave the actual file alone and just remove it from > tracking> Backups are always a good thing though. > -- > 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: Spam in my comments
For what? A link? Your user could paste a link. There's no easy way to tell that a comment is a spam (you would need a tool to perform analysis on the comment content to mark it as spam, that's exactly what tools like Askimet do). - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Fri, Dec 19, 2008 at 7:42 PM, bingo bob wrote: > > > OK but what about just validation statements in the models? > > Can I do it like that, maybe screening for some regex's ? > -- > 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: Spam in my comments
OK but what about just validation statements in the models? Can I do it like that, maybe screening for some regex's ? -- 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: Spam in my comments
You might use negative captchas, require login, common captchas, the askimet web service, there are plenty of ways to avoid spamming :) - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Fri, Dec 19, 2008 at 7:39 PM, bingo bob wrote: > > > I've started to get problems with my rails site, I've had loads of > comments containing stuff like this... > > http://pastie.org/343379 > > What can I do (have taken the site down for now). > > I'm after a really simple solution, can i just do some clever validation > to fail this cr&p? > > I don't really want to implement captcha or the like if I can avoid it. > > Site is down for now until I figure a solution, please let me know if > you can help? > > Thanks, > > BB. > -- > 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] Spam in my comments
I've started to get problems with my rails site, I've had loads of comments containing stuff like this... http://pastie.org/343379 What can I do (have taken the site down for now). I'm after a really simple solution, can i just do some clever validation to fail this cr&p? I don't really want to implement captcha or the like if I can avoid it. Site is down for now until I figure a solution, please let me know if you can help? Thanks, BB. -- 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: Ruby vs. RubyOnRails compatibility matrix ?
Hi Rob, > Well, since I know that Rails 1.1.6 and 1.2.2 application will run > fine under Ruby 1.8.6 (and 1.8.5), I'll start you with that. There's > plenty of evidence that Ruby 1.8.7 is more of a prequel to 1.9 than an > upgrade to 1.8.6 so you'll have to collect your own evidence about > older Rails running on Ruby 1.8.7. Thanks for your feedback on 1.1.6 and 1.2.2. I'll start by upgrading to 1.8.6, seems like a pretty good candidate. thanks! -- Thibaut --~--~-~--~~~---~--~~ You received 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] Setting a CSS class on select helper
Hi, I'm trying to put a css class on a dropdown box built using a select helper (to make it wider) but I can't get it to take. I thought for sure, and from what I've seen elsewhere, this code should work: <%= f.select :month, 1..12, :selected => Time.now.month.to_i, :class => 'monthSelect' %> Suggestions? Thanks -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] [ANN] Lun - Free Commenting Service for Any Web Pages
Hi, We have launched a free service, Lun - http://lun.competo.com, to provide commenting interactions to any web pages with static or dynamic contents. It's built on Rail 2.2.2. Plus it provides: Latest comments, Top posts and Comments counters. Supported browsers: IE 6, FireFox 2/3, Opera, Safari and Chrome. Check it out and it only takes a minute to set it up on your web page. Regards, Lun team -- 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: before_filter for a specific controller/action
On 19 Dec 2008, at 19:58, Scott Peterson wrote: > > I'm learning about before_filter, implementing a simple "you must be > logged on" thing. > > It works great, but I need to allow people to create a player as well. > stick skip_before_filter :foo, :only => :new in PlayersController Fred > By writing the except as attached, that works, but then everyone has > access to all "new" methods, which I don't really want. > > Can someone help me with how to properly construct this to limit > non-logged in access to the new method of the players controller? > > Attachments: > http://www.ruby-forum.com/attachment/3089/application.rb > > -- > Posted via http://www.ruby-forum.com/. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-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 setup - I'm losing it here.
sorry thats http://www.google.com/url?sa=U&start=6&q=http://my.safaribooksonline.com/9780321606709/app01lev1sec3%3Fportal%3Doreilly&ei=yw5MSbGzHJmWsAOm9PCRDQ&sig2=jV-ITmnlJptkowoubvXwtQ&usg=AFQjCNH315zLo_wW_m0Gs3FGh9fr_sr7Rg On Dec 19, 1:19 pm, Tim McIntyre wrote: > Try > > /Applications/MAMP/Library/bin/mysql -u root > > http://my.safaribooksonline.com/9780321606709/app01lev1sec3?portal=or... > > good luck! > Tim > > On Dec 19, 11:19 am, Ryan Ororie > wrote: > > > Newbie here (who else.) I feel confident I can excel in the actual > > programming of rails apps. But all the tutorials just glaze over mySQL > > which seems to me, by far, the most problematic area for new users. > > > I have tried a ton of different things here. I know mySQL is installed > > and running in one place or another. I don't know how to tell my rails > > app with the hell to do about it. I do have the "Welcome Aboard" screen > > showing at localhost:3000 with the following details: > > > Ruby version 1.8.6 (i686-darwin8.9.1) > > RubyGems version 0.9.2 > > Rails version 1.2.3 > > Active Record version 1.15.3 > > Action Pack version 1.13.3 > > Action Web Service version 1.2.3 > > Action Mailer version 1.3.3 > > Active Support version 1.4.2 > > Application root /Users/rmorourk/Sites/depot > > Environment development > > Database adapter mysql > > > When I try to do something with the database here is what I run into. > > > bio4054059:depot rmorourk$ rake db:migrate > > (in /Users/rmorourk/Sites/depot) > > rake aborted! > > Unknown database 'depot_development' > > > The development portion of my database.yml file looks like this: > > > development: > > adapter: mysql > > database: depot_development > > username: root > > password: root > > host: localhost > > socket: /Applications/MAMP/tmp/mysql/mysql.sock > > > I added the socket line after I installed MAMP as per a tutorial... But > > when I am in the terminal and I want to do something with the database, > > like; > > > bio4054059:depot rmorourk$ mysql -uroot depot_development > > -bash: mysql: command not found > > > I get the error on the second line --- any advise? I assume this has to > > be a issue of im not telling something to look in the right somewhere, > > but I am about ready to put my fist in the wall on this thing. I would > > LOVE some advise! > > > Thanks!! > > -- > > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: nil object in create_time_zone_conversion_attribute?
Some further information This issue is apparently caused by not passing enough parameters to the route helpers when you have nested resources. For example, I have a gallery, which has a nested image resource. When generating links in the view, I called the helper, but I didn't pass an array with both the gallery and the image, only the image. The first time presenting the view would work; the second, I would get the stack trace, and from that point on the mongrel instance is hooped, and would not serve any content. It would have to be restarted. I've fixed the view, and the problem is now resolved. However, I'm concerned about being able to crash mongrel hard this way. On Dec 19, 1:47 pm, KenM wrote: > Full trace below... > > This issue is not machine specific, as I get the same error on my > laptop. Both systems are up to date with respect to gems > > NoMethodError (You have a nil object when you didn't expect it! > You might have expected an instance of Array. > The error occurred while evaluating nil.include?): > /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ > active_record/attribute_methods.rb:142:in > `create_time_zone_conversion_attribute?' > /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ > active_record/attribute_methods.rb:75:in `define_attribute_methods' > /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ > active_record/attribute_methods.rb:71:in `each' > /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ > active_record/attribute_methods.rb:71:in `define_attribute_methods' > /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ > active_record/attribute_methods.rb:242:in `method_missing' > /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ > active_record/base.rb:2662:in `hash' > /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/dispatcher.rb:150:in `clear' > /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/dispatcher.rb:150:in `reload_application' > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/callbacks.rb:178:in `send' > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/callbacks.rb:178:in `evaluate_method' > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/callbacks.rb:166:in `call' > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/callbacks.rb:90:in `run' > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/callbacks.rb:90:in `each' > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/callbacks.rb:90:in `send' > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/callbacks.rb:90:in `run' > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/callbacks.rb:277:in `run_callbacks' > /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/dispatcher.rb:109:in `dispatch_unlocked' > /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/dispatcher.rb:123:in `dispatch' > /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/dispatcher.rb:122:in `synchronize' > /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/dispatcher.rb:122:in `dispatch' > /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/dispatcher.rb:132:in `dispatch_cgi' > /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ > action_controller/dispatcher.rb:39:in `dispatch' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ > rails.rb:76:in `process' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ > rails.rb:74:in `synchronize' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ > rails.rb:74:in `process' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 159:in `process_client' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 158:in `each' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 158:in `process_client' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 285:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 285:in `initialize' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 285:in `new' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 285:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 268:in `initialize' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 268:in `new' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: > 268:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ > configurator.rb:282:in `run' > /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ > conf
[Rails] Re: link_to helper in an Array.each
Worked like a charm, 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: mySQL setup - I'm losing it here.
sorry that's http://my.safaribooksonline.com/9780321606709/app01lev1sec3?portal=oreilly On Dec 19, 1:19 pm, Tim McIntyre wrote: > Try > > /Applications/MAMP/Library/bin/mysql -u root > > http://my.safaribooksonline.com/9780321606709/app01lev1sec3?portal=or... > > good luck! > Tim > > On Dec 19, 11:19 am, Ryan Ororie > wrote: > > > Newbie here (who else.) I feel confident I can excel in the actual > > programming of rails apps. But all the tutorials just glaze over mySQL > > which seems to me, by far, the most problematic area for new users. > > > I have tried a ton of different things here. I know mySQL is installed > > and running in one place or another. I don't know how to tell my rails > > app with the hell to do about it. I do have the "Welcome Aboard" screen > > showing at localhost:3000 with the following details: > > > Ruby version 1.8.6 (i686-darwin8.9.1) > > RubyGems version 0.9.2 > > Rails version 1.2.3 > > Active Record version 1.15.3 > > Action Pack version 1.13.3 > > Action Web Service version 1.2.3 > > Action Mailer version 1.3.3 > > Active Support version 1.4.2 > > Application root /Users/rmorourk/Sites/depot > > Environment development > > Database adapter mysql > > > When I try to do something with the database here is what I run into. > > > bio4054059:depot rmorourk$ rake db:migrate > > (in /Users/rmorourk/Sites/depot) > > rake aborted! > > Unknown database 'depot_development' > > > The development portion of my database.yml file looks like this: > > > development: > > adapter: mysql > > database: depot_development > > username: root > > password: root > > host: localhost > > socket: /Applications/MAMP/tmp/mysql/mysql.sock > > > I added the socket line after I installed MAMP as per a tutorial... But > > when I am in the terminal and I want to do something with the database, > > like; > > > bio4054059:depot rmorourk$ mysql -uroot depot_development > > -bash: mysql: command not found > > > I get the error on the second line --- any advise? I assume this has to > > be a issue of im not telling something to look in the right somewhere, > > but I am about ready to put my fist in the wall on this thing. I would > > LOVE some advise! > > > Thanks!! > > -- > > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ruby vs. RubyOnRails compatibility matrix ?
On Dec 19, 2008, at 4:13 PM, Thibaut Barrère wrote: > Hello, > > I'm looking for some compatibility matrix between specific versions of > Ruby (like 1.8.5, 1.8.6...) and specific versions of Rails (like > 1.1.6, 1.2.2 etc). > > I'm in a position where I'll have to upgrade Ruby (to 1.8.6 or 1.8.7) > for old Rails app (typically 1.1.6 and 1.2.2), and that kind of > upgrade is likely to become more and more frequent. > > Any hint ? > > thanks! > > Thibaut Well, since I know that Rails 1.1.6 and 1.2.2 application will run fine under Ruby 1.8.6 (and 1.8.5), I'll start you with that. There's plenty of evidence that Ruby 1.8.7 is more of a prequel to 1.9 than an upgrade to 1.8.6 so you'll have to collect your own evidence about older Rails running on Ruby 1.8.7. -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: mySQL setup - I'm losing it here.
Try /Applications/MAMP/Library/bin/mysql -u root http://my.safaribooksonline.com/9780321606709/app01lev1sec3?portal=oreilly good luck! Tim On Dec 19, 11:19 am, Ryan Ororie wrote: > Newbie here (who else.) I feel confident I can excel in the actual > programming of rails apps. But all the tutorials just glaze over mySQL > which seems to me, by far, the most problematic area for new users. > > I have tried a ton of different things here. I know mySQL is installed > and running in one place or another. I don't know how to tell my rails > app with the hell to do about it. I do have the "Welcome Aboard" screen > showing at localhost:3000 with the following details: > > Ruby version 1.8.6 (i686-darwin8.9.1) > RubyGems version 0.9.2 > Rails version 1.2.3 > Active Record version 1.15.3 > Action Pack version 1.13.3 > Action Web Service version 1.2.3 > Action Mailer version 1.3.3 > Active Support version 1.4.2 > Application root /Users/rmorourk/Sites/depot > Environment development > Database adapter mysql > > When I try to do something with the database here is what I run into. > > bio4054059:depot rmorourk$ rake db:migrate > (in /Users/rmorourk/Sites/depot) > rake aborted! > Unknown database 'depot_development' > > The development portion of my database.yml file looks like this: > > development: > adapter: mysql > database: depot_development > username: root > password: root > host: localhost > socket: /Applications/MAMP/tmp/mysql/mysql.sock > > I added the socket line after I installed MAMP as per a tutorial... But > when I am in the terminal and I want to do something with the database, > like; > > bio4054059:depot rmorourk$ mysql -uroot depot_development > -bash: mysql: command not found > > I get the error on the second line --- any advise? I assume this has to > be a issue of im not telling something to look in the right somewhere, > but I am about ready to put my fist in the wall on this thing. I would > LOVE some advise! > > Thanks!! > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Ruby vs. RubyOnRails compatibility matrix ?
Hello, I'm looking for some compatibility matrix between specific versions of Ruby (like 1.8.5, 1.8.6...) and specific versions of Rails (like 1.1.6, 1.2.2 etc). I'm in a position where I'll have to upgrade Ruby (to 1.8.6 or 1.8.7) for old Rails app (typically 1.1.6 and 1.2.2), and that kind of upgrade is likely to become more and more frequent. Any hint ? thanks! Thibaut --~--~-~--~~~---~--~~ You received 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: MySpace.com clone using Ruby on Rails. Is it possible?
Thank you for this response. Ii helps me a lot. -- 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: Problem with Regular Expression
On Dec 19, 2008, at 3:26 PM, Corey Murphy wrote: > Rob Biedenharn wrote: >> However, it looks like your input is CSV so why not let a CSV library >> do the heavy-lifting for you: > > Primarily because this is a budget application I'm writing and the > data > coming from Accounts Payable (.csv files) need to be read in and then > massaged some before moving it into the database. A lot of the > massaging relates to categorizing transactions and associating other > information with a record that isn't a part of the original input > file. > So, I'm manually parsing this data into an array for active record > column attribute assignment and the like. > > Unless fasterCSV reads a file in for me and give me the data in an > array > I can use in my model or controller for further processing, it doesn't > fit my needs. So forgive my ignorance if it does do this and I'm > simply > not aware. However, if it does, then woohoo and I'll be pulling down > the gem pronto. Then start now! gem install fastercsv I was just using one of the lower-level methods to parse your input line. I'll let you read the docs[1] for yourself, but it will read the file and give the data back to you as an array or a hash (you choose). You can configure whether there are first-row headers, too. -Rob [1] http://fastercsv.rubyforge.org/ 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: Noob - added a column via migration but get error on insert
Hassan Schroeder wrote: > > I believe so -- but it should be easy enough to find out, eh? :-) > > Let me know if that doesn't fix the problem. > Thanks! That did the trick. So anytime I make a DB modification and am working via the console I need to restart it so it will become aware of the changes. Very interesting. -- 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: Noob - added a column via migration but get error on insert
On Fri, Dec 19, 2008 at 12:44 PM, Brian A. wrote: >> And did you restart the console after running the migration? > Yes I did perform the migrations and can see the new 'email' column in > the database. I did not restart the console however. Does Rails need > to be restarted to learn about changes like this? I believe so -- but it should be easy enough to find out, eh? :-) Let me know if that doesn't fix the problem. -- Hassan Schroeder hassan.schroe...@gmail.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: nil object in create_time_zone_conversion_attribute?
Full trace below... This issue is not machine specific, as I get the same error on my laptop. Both systems are up to date with respect to gems NoMethodError (You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.include?): /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/attribute_methods.rb:142:in `create_time_zone_conversion_attribute?' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/attribute_methods.rb:75:in `define_attribute_methods' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/attribute_methods.rb:71:in `each' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/attribute_methods.rb:71:in `define_attribute_methods' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/attribute_methods.rb:242:in `method_missing' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/base.rb:2662:in `hash' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:150:in `clear' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:150:in `reload_application' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/callbacks.rb:178:in `send' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/callbacks.rb:178:in `evaluate_method' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/callbacks.rb:166:in `call' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/callbacks.rb:90:in `run' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/callbacks.rb:90:in `each' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/callbacks.rb:90:in `send' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/callbacks.rb:90:in `run' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/callbacks.rb:277:in `run_callbacks' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:109:in `dispatch_unlocked' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:123:in `dispatch' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:122:in `synchronize' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:122:in `dispatch' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:132:in `dispatch_cgi' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/dispatcher.rb:39:in `dispatch' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ rails.rb:76:in `process' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ rails.rb:74:in `synchronize' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ rails.rb:74:in `process' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 159:in `process_client' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 158:in `each' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 158:in `process_client' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 285:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 285:in `initialize' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 285:in `new' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 285:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 268:in `initialize' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 268:in `new' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb: 268:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:282:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:281:in `each' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:281:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails: 128:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ command.rb:212:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails: 281 /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/dependencies.rb:142:in `load_without_new_constant_marking' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/dependencies.rb:142:in `load' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/dependencies.rb:521:in `new_constants_in' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ active_support/dependencies.rb:142:in `load' /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/
[Rails] Re: mySQL setup - I'm losing it here.
On Fri, Dec 19, 2008 at 12:02 PM, Ryan Ororie wrote: > First, how do I add it to my PATH? Second, I used this to install mySQL: > http://www.mamp.info/en/index.php > > Not sure if that was necessary/proper. Definitely not necessary, but whatever -- let's assume it worked for the moment :-) > The install folder for MAMP has this: > /Applications/MAMP/tmp/mysql/ > > Which holds two files mysql.pid and mysqp.sock - am I correct in > assuming that those are the executables I need to set my path too? No. The first contains the process id of the mysql server, and the other is the socket used to communicate with it. I'd imagine that somewhere under /Applications/MAMP is a directory with a bunch of files with names starting with mysql. Look around, or run this from a prompt: find /Application/MAMP -type f -name 'mysql*' -print > Symlinks? Um, I'd recommend doing a little reading up on general *nix/shell use. ("symlinks" is short for "symbolic links" -- a way to have a file referenced from a different directory than it's really located in.) But we can skip that for now; you just need to find what to add to your PATH. And Rick already explained that. Oh, yeah, but it's `echo $PATH`, not `print`. HTH, -- Hassan Schroeder hassan.schroe...@gmail.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: Noob - added a column via migration but get error on insert
Hassan Schroeder wrote: > On Fri, Dec 19, 2008 at 12:30 PM, Brian A. > wrote: > > There should be a step 4a) here -- rake db:migrate > > Did you do that? If so, can you confirm that the table was altered? > > And did you restart the console after running the migration? > Hello! Yes I did perform the migrations and can see the new 'email' column in the database. I did not restart the console however. Does Rails need to be restarted to learn about changes like this? 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] Noob - added a column via migration but get error on insert
Hello! I'm very new to ruby and ruby on rails. I'm following a tutorial found here: www.javapassion.com/handsonlabs/rails_activerecord/ I'm running NetBeans as an IDE, with jruby, rails and MySQL. Here is the basic rundown of what I have done 1) Created db via Rake 2) Created table with 3 columns via Migration (user name:string hobby:string age:integer) 3) Inserted 3 user records via Rails Console 4) Added additional column via Migration (AddEmailField email:string) (Inside the migration rb -> "add_column :users, :email, :string" 5) This is where things go poorly, I try to add a new user with the email but get an error. Here is what I enter via Rails Console user = User.new(:name => "TommyJones", :hobby => "tennis", :age => 138, :email => "ema...@asdfgmail.com") And I get the following error: -- NoMethodError: undefined method `email=' for # from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:251:in `method_missing' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2361:in `attributes=' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2360:in `each' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2360:in `attributes=' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2130:in `initialize' from (irb):23:in `binding' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/1.8/irb.rb:150:in `eval_input' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/1.8/irb.rb:259:in `signal_status' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/1.8/irb.rb:147:in `eval_input' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/1.8/irb.rb:146:in `eval_input' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/1.8/irb.rb:70:in `start' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/1.8/irb.rb:69:in `catch' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4/lib/ruby/1.8/irb.rb:69:in `start' from C:/Program Files/NetBeans 6.5 RC2/ruby2/jruby-1.1.4\bin\jirb:19 - Being so new to this I cannot figure out why it won't allow me to enter a user using all the fields? If I do the same entry without the email information to insert it still works. 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: Noob - added a column via migration but get error on insert
On Fri, Dec 19, 2008 at 12:30 PM, Brian A. wrote: > 1) Created db via Rake > 2) Created table with 3 columns via Migration (user name:string > hobby:string age:integer) > 3) Inserted 3 user records via Rails Console > 4) Added additional column via Migration (AddEmailField email:string) > (Inside the migration rb -> "add_column :users, :email, :string" There should be a step 4a) here -- rake db:migrate Did you do that? If so, can you confirm that the table was altered? > 5) This is where things go poorly, I try to add a new user with the > email but get an error. Here is what I enter via Rails Console > user = User.new(:name => "TommyJones", :hobby => "tennis", :age => 138, > :email => "ema...@asdfgmail.com") And did you restart the console after running the migration? -- Hassan Schroeder hassan.schroe...@gmail.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: Recommended way of restricting action permissions?
Thanks a lot for the replies! I guess I kind of prefer the before_filter method a little bit because then I don't have to replicate the redirect_if_not_found logic in each restricted action. Thanks again! --~--~-~--~~~---~--~~ You received 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: before_filter for a specific controller/action
This post might help: http://rails.lighthouseapp.com/projects/8994/tickets/946-pass-blocks-to-beforeafter-filter-methods-using-with-option On Dec 19, 11:58 am, Scott Peterson wrote: > I'm learning about before_filter, implementing a simple "you must be > logged on" thing. > > It works great, but I need to allow people to create a player as well. > > By writing the except as attached, that works, but then everyone has > access to all "new" methods, which I don't really want. > > Can someone help me with how to properly construct this to limit > non-logged in access to the new method of the players controller? > > Attachments:http://www.ruby-forum.com/attachment/3089/application.rb > > -- > 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: Problem with Regular Expression
Rob Biedenharn wrote: > However, it looks like your input is CSV so why not let a CSV library > do the heavy-lifting for you: Primarily because this is a budget application I'm writing and the data coming from Accounts Payable (.csv files) need to be read in and then massaged some before moving it into the database. A lot of the massaging relates to categorizing transactions and associating other information with a record that isn't a part of the original input file. So, I'm manually parsing this data into an array for active record column attribute assignment and the like. Unless fasterCSV reads a file in for me and give me the data in an array I can use in my model or controller for further processing, it doesn't fit my needs. So forgive my ignorance if it does do this and I'm simply not aware. However, if it does, then woohoo and I'll be pulling down the gem pronto. -- 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: Recommended way of restricting action permissions?
Ms. Klein, I handle that situation very similarly with the only disparity being where ownership is determined. In my opinion the object itself should know nothing about @current_user, whereas the application can know about Resource.user. I also tend to alias methods in my resources, like so def self.owner self.user end Then I insure that every object has some owner alias if it is to be restricted, and in my :require_ownership before_filter, I do the following: def require_ownership if @resource.owner == @current.user ... end The end effect is the same, but this allows the resource to be used intact in another application without modification, regardless of @current_user in the other application. Just of matter of who knows what about whom. Otherwise, unless someone can suggest a better method for us both, I personally think you're on the right track. Cheers, Darrik Mazey Lisa Klein wrote: > Hi, I just have a "best practices" question. I'd like to block users > that don't own a particular resource from performing edit/update/ > destroy actions on it. Here's how I currently do it: > > ## User has many resources, of different types > > --- resource_controller.rb --- > > before_filter :require_ownership, :only => [:edit, :update, :destroy] > > ... public actions ... > > protected > > def require_ownership > @resource = Resource.find(params[:id]) > redirect_to_somewhere unless owns?(@resource) > end > > --- application.rb --- > > def owns?(resource) > resource.user_id == @current_user.id > end > > ... And I apply this before_filter in the controller of any resource > I'd like to restrict in a similar way. I'm new to Rails and MVC so > I'm just wondering whether this is the best way of accomplishing this, > or if a different method is recommended. > > Thanks in advance! > > > -- Darrik Mazey Developer DMT Programming, LLC. P.O. Box 91 Torrington, CT 06790 office: 330.983.9941 fax: 330.983.9942 mobile: 330.808.2025 dar...@dmtprogramming.com To obtain my public key, send an email to dar...@publickey.dmtprogramming.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: Sending a file, FTP protocol
Hi Tim, The files to download are on a FTP server. The user should be able to copy a download code into a textfield and click a download button. The file should automatically begin downloading and the URL should be hidden. That's why initially I had the send_file option on a controller action (when I thought it was via HTTP) Thanks again, Elías On Dec 19, 2:54 pm, Tim McIntyre wrote: > Is the FTP server running on the same box or the same local network. > If so is there some overriding reason that it has to be delivered via > FTP? > > On Dec 19, 11:49 am, elioncho wrote: > > > Thanks Tim, > > > The thing is the user is going to download from a FTP server so I > > can't use send_file. > > > On Dec 19, 2:37 pm, Tim McIntyre wrote: > > > > If the file is located on the same box as your web app you may want to > > > try sending the path as opposed to the completeurl. Just a thought: > > > > send_file "/full/path/uploads/babe.jpg" > > > > Although the docs say the default is to send a binary attachment it > > > seems I had to play with the headers a bit, although i am using > > > mod_xsendfile (http://tn123.ath.cx/mod_xsendfile/) so that may have > > > mixed things up a bit can't recall. I'm also doing: > > > > render :nothing => true > > > > at the end of my controller action. > > > > Hope that helps, good luck! > > > Tim > > > > On Dec 19, 10:58 am, elioncho wrote: > > > > > Hello Frederick, > > > > > Thanks for your input. In my case, the user shoulddownloadthe file > > > > from the ftp server and when I use a redirect to theURLthe file is > > > > rendered on the browser (photo or mp3) and theURLbecomes visible. My > > > > goal is tohidetheURLfrom where the file is coming and make the > > > > userdownloadthe file locally. > > > > > Thanks again, > > > > > Elías > > > > > On Dec 19, 1:48 pm, Frederick Cheung > > > > wrote: > > > > > > On 19 Dec 2008, at 18:30, elioncho wrote: > > > > > > > Hello, > > > > > > > I was using the method send_file from an action on one of my > > > > > > controllers to send a file to the users. The thing is that now the > > > > > > file will be stored in an FTP and send_file only works with the HTTP > > > > > > protocol. What can I do in this situation? This is what I had that > > > > > > worked via HTTP: > > > > > > > def get_it > > > > > > send_file "http://www.elioncho.com/uploads/babe.jpg"; > > > > > > end > > > > > > All send_file does it put the contents of a local file into your http > > > > > > > > > > response. If you need to get a file from an ftp server and pass it to > > > > > > > > > > the user I reckon you'd be better off redirecting them to theurl. If > > > > > you need to save a file to an ftp server you could look into Net::FTP > > > > > > > > > > (but that would block your mongrel for the duration of the transfer) > > > > > > 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] Re: Problem with Regular Expression
On Dec 19, 2008, at 2:58 PM, Frederick Cheung wrote: > On 19 Dec 2008, at 19:48, Corey Murphy s.net> wrote: > >> Why would the following regular expression produce the results below? >> >> input: >> john,doe,"1,200.99",training,12345 >> >> code executed on input: >> values = line.split(/("\d*,\d+\.\d*")|,/) >> >> output: >> ["john","doe","","1,200.99","","training","12345"] >> > Pretend you're split. You see the comma after doe so you split. Then > you see the other part of your regex and so you split again, resulting > in the empty array > > Fred >> What's up with the two empty array indexes that are generated during >> the >> split surrounding my dollar value? >> >> The regular expression is pretty explicit and the input string >> doesn't >> contain anything that should cause them when run through the >> expression, >> yet there they are so obviously I'm doing something wrong in my >> regexp. >> Help. I think you actually get: => ["john", "doe", "", "\"1,200.99\"", "", "training", "12345"] as your output. (At least I do.) However, it looks like your input is CSV so why not let a CSV library do the heavy-lifting for you: irb> require 'rubygems' => true irb> require 'fastercsv' => true irb> FasterCSV.parse_line(line) => ["john", "doe", "1,200.99", "training", "12345"] Note: FasterCSV becomes the CSV in the standard library for Ruby 1.9, but it's a gem before that so look at the rdocs/ri for whatever you're using. -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: Recommended way of restricting action permissions?
The simpler way is just search the user resources when performing an edit/update/delete. like this: def edit @resource = @user.resources.find(params[:id]) end This way you can be sure that the user will not be able to select a resource that doesn't belong to him. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Fri, Dec 19, 2008 at 5:14 PM, Lisa Klein wrote: > > Hi, I just have a "best practices" question. I'd like to block users > that don't own a particular resource from performing edit/update/ > destroy actions on it. Here's how I currently do it: > > ## User has many resources, of different types > > --- resource_controller.rb --- > > before_filter :require_ownership, :only => [:edit, :update, :destroy] > > ... public actions ... > > protected > > def require_ownership > @resource = Resource.find(params[:id]) > redirect_to_somewhere unless owns?(@resource) > end > > --- application.rb --- > > def owns?(resource) > resource.user_id == @current_user.id > end > > ... And I apply this before_filter in the controller of any resource > I'd like to restrict in a similar way. I'm new to Rails and MVC so > I'm just wondering whether this is the best way of accomplishing this, > or if a different method is recommended. > > Thanks in advance! > > > --~--~-~--~~~---~--~~ You received 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] Recommended way of restricting action permissions?
Hi, I just have a "best practices" question. I'd like to block users that don't own a particular resource from performing edit/update/ destroy actions on it. Here's how I currently do it: ## User has many resources, of different types --- resource_controller.rb --- before_filter :require_ownership, :only => [:edit, :update, :destroy] ... public actions ... protected def require_ownership @resource = Resource.find(params[:id]) redirect_to_somewhere unless owns?(@resource) end --- application.rb --- def owns?(resource) resource.user_id == @current_user.id end ... And I apply this before_filter in the controller of any resource I'd like to restrict in a similar way. I'm new to Rails and MVC so I'm just wondering whether this is the best way of accomplishing this, or if a different method is recommended. Thanks in advance! --~--~-~--~~~---~--~~ You received 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: Problem with Regular Expression
Frederick Cheung wrote: > Pretend you're split. You see the comma after doe so you split. Then > you see the other part of your regex and so you split again, resulting > in the empty array > > Fred Ok, but the pipe character stands for alternation much like an OR so once it sees doe and splits, the next part of the csv input it evaluates should match to the monetary portion of the regex so it splits around it. Maybe I'm just not getting somethings because I want it to split my (comma delimited) input line based on comma or when a value is wrapped with double quotes. I can always handle the extra empty array positions by simple performing a array.delete_if with a block that looks for empty strings but that seems like overkill if I could handle it with the regex instead. Sorry if I'm still not getting the point. -- 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: mySQL setup - I'm losing it here.
How did you install mysql? If you used port then its mysql5 not mysql which is the command to open the mysql client... If you are trying to install mysql using anything other than macports.. dont't... I recommend that you go to macports.org site and download the latest version... On Dec 19, 12:02 pm, Ryan Ororie wrote: > > Which simply means MySQL isn't in your PATH. You need to find > > where the MySQL executables are installed and add that directory > > to your path. Or create symlinks to, say, /usr/local/bin. > > First, how do I add it to my PATH? Second, I used this to install > mySQL:http://www.mamp.info/en/index.php > > Not sure if that was necessary/proper. > > The install folder for MAMP has this: > /Applications/MAMP/tmp/mysql/ > > Which holds two files mysql.pid and mysqp.sock - am I correct in > assuming that those are the executables I need to set my path too? > > Symlinks? > > Thanks for the help thus far! > -- > 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: mySQL setup - I'm losing it here.
> Which simply means MySQL isn't in your PATH. You need to find > where the MySQL executables are installed and add that directory > to your path. Or create symlinks to, say, /usr/local/bin. First, how do I add it to my PATH? Second, I used this to install mySQL: http://www.mamp.info/en/index.php Not sure if that was necessary/proper. The install folder for MAMP has this: /Applications/MAMP/tmp/mysql/ Which holds two files mysql.pid and mysqp.sock - am I correct in assuming that those are the executables I need to set my path too? Symlinks? Thanks for the help thus far! -- 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] before_filter for a specific controller/action
I'm learning about before_filter, implementing a simple "you must be logged on" thing. It works great, but I need to allow people to create a player as well. By writing the except as attached, that works, but then everyone has access to all "new" methods, which I don't really want. Can someone help me with how to properly construct this to limit non-logged in access to the new method of the players controller? Attachments: http://www.ruby-forum.com/attachment/3089/application.rb -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-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: Problem with Regular Expression
On 19 Dec 2008, at 19:48, Corey Murphy wrote: > > Why would the following regular expression produce the results below? > > input: > john,doe,"1,200.99",training,12345 > > code executed on input: > values = line.split(/("\d*,\d+\.\d*")|,/) > > output: > ["john","doe","","1,200.99","","training","12345"] > Pretend you're split. You see the comma after doe so you split. Then you see the other part of your regex and so you split again, resulting in the empty array Fred > What's up with the two empty array indexes that are generated during > the > split surrounding my dollar value? > > The regular expression is pretty explicit and the input string doesn't > contain anything that should cause them when run through the > expression, > yet there they are so obviously I'm doing something wrong in my > regexp. > 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: Sending a file, FTP protocol
Is the FTP server running on the same box or the same local network. If so is there some overriding reason that it has to be delivered via FTP? On Dec 19, 11:49 am, elioncho wrote: > Thanks Tim, > > The thing is the user is going to download from a FTP server so I > can't use send_file. > > On Dec 19, 2:37 pm, Tim McIntyre wrote: > > > If the file is located on the same box as your web app you may want to > > try sending the path as opposed to the completeurl. Just a thought: > > > send_file "/full/path/uploads/babe.jpg" > > > Although the docs say the default is to send a binary attachment it > > seems I had to play with the headers a bit, although i am using > > mod_xsendfile (http://tn123.ath.cx/mod_xsendfile/) so that may have > > mixed things up a bit can't recall. I'm also doing: > > > render :nothing => true > > > at the end of my controller action. > > > Hope that helps, good luck! > > Tim > > > On Dec 19, 10:58 am, elioncho wrote: > > > > Hello Frederick, > > > > Thanks for your input. In my case, the user shoulddownloadthe file > > > from the ftp server and when I use a redirect to theURLthe file is > > > rendered on the browser (photo or mp3) and theURLbecomes visible. My > > > goal is tohidetheURLfrom where the file is coming and make the > > > userdownloadthe file locally. > > > > Thanks again, > > > > Elías > > > > On Dec 19, 1:48 pm, Frederick Cheung > > > wrote: > > > > > On 19 Dec 2008, at 18:30, elioncho wrote: > > > > > > Hello, > > > > > > I was using the method send_file from an action on one of my > > > > > controllers to send a file to the users. The thing is that now the > > > > > file will be stored in an FTP and send_file only works with the HTTP > > > > > protocol. What can I do in this situation? This is what I had that > > > > > worked via HTTP: > > > > > > def get_it > > > > > send_file "http://www.elioncho.com/uploads/babe.jpg"; > > > > > end > > > > > All send_file does it put the contents of a local file into your http > > > > response. If you need to get a file from an ftp server and pass it to > > > > the user I reckon you'd be better off redirecting them to theurl. If > > > > you need to save a file to an ftp server you could look into Net::FTP > > > > (but that would block your mongrel for the duration of the transfer) > > > > > 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] Re: mySQL setup - I'm losing it here.
Rick wrote: > Hello Ryan, > >> � � bio4054059:depot rmorourk$ mysql -uroot depot_development >> � � -bash: mysql: command not found > > "command not found" is your shell telling you that whatever directory > you have installed mysql in to is not on your search path. > > If you type "print $PATH" you will see a colon separated ordered list > of directories that are searched for executable commands. To > temporarily extend the list just type: set PATH=MYSQLHOME:$PATH where > MYSQLHOME is the full path to the directory containing mysql > executable. i.e. MSQLHOME might be /usr/local/mysql/bin. You should > then be able to execute the mysql -uroot... command. > > Once you have success with this, you should modify your shell startup > file to make the PATH change permanent. Depending on what shell you > use this could be .profile, .cshrc, .tshrc, ... > > Rick Thanks, here is what I tried: bio4054059:~ rmorourk$ print $PATH -bash: print: command not found bio4054059:~ rmorourk$ set PATH=/Applications/MAMP/tmp/mysql/:$PATH bio4054059:~ rmorourk$ mysql -uroot -bash: mysql: command not found Any ideas? I'm using the default terminal on MAC OS X.. -- 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: Sending a file, FTP protocol
Thanks Tim, The thing is the user is going to download from a FTP server so I can't use send_file. On Dec 19, 2:37 pm, Tim McIntyre wrote: > If the file is located on the same box as your web app you may want to > try sending the path as opposed to the completeurl. Just a thought: > > send_file "/full/path/uploads/babe.jpg" > > Although the docs say the default is to send a binary attachment it > seems I had to play with the headers a bit, although i am using > mod_xsendfile (http://tn123.ath.cx/mod_xsendfile/) so that may have > mixed things up a bit can't recall. I'm also doing: > > render :nothing => true > > at the end of my controller action. > > Hope that helps, good luck! > Tim > > On Dec 19, 10:58 am, elioncho wrote: > > > Hello Frederick, > > > Thanks for your input. In my case, the user shoulddownloadthe file > > from the ftp server and when I use a redirect to theURLthe file is > > rendered on the browser (photo or mp3) and theURLbecomes visible. My > > goal is tohidetheURLfrom where the file is coming and make the > > userdownloadthe file locally. > > > Thanks again, > > > Elías > > > On Dec 19, 1:48 pm, Frederick Cheung > > wrote: > > > > On 19 Dec 2008, at 18:30, elioncho wrote: > > > > > Hello, > > > > > I was using the method send_file from an action on one of my > > > > controllers to send a file to the users. The thing is that now the > > > > file will be stored in an FTP and send_file only works with the HTTP > > > > protocol. What can I do in this situation? This is what I had that > > > > worked via HTTP: > > > > > def get_it > > > > send_file "http://www.elioncho.com/uploads/babe.jpg"; > > > > end > > > > All send_file does it put the contents of a local file into your http > > > response. If you need to get a file from an ftp server and pass it to > > > the user I reckon you'd be better off redirecting them to theurl. If > > > you need to save a file to an ftp server you could look into Net::FTP > > > (but that would block your mongrel for the duration of the transfer) > > > > 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] Re: mySQL setup - I'm losing it here.
On Fri, Dec 19, 2008 at 11:19 AM, Ryan Ororie wrote: > I have tried a ton of different things here. I know mySQL is installed > and running in one place or another. I don't know how to tell my rails > app with the hell to do about it. I > When I try to do something with the database here is what I run into. > >bio4054059:depot rmorourk$ rake db:migrate >(in /Users/rmorourk/Sites/depot) >rake aborted! >Unknown database 'depot_development' So you haven't created that database yet. No mystery there. :-) > when I am in the terminal and I want to do something with the database, > like; > >bio4054059:depot rmorourk$ mysql -uroot depot_development >-bash: mysql: command not found Which simply means MySQL isn't in your PATH. You need to find where the MySQL executables are installed and add that directory to your path. Or create symlinks to, say, /usr/local/bin. This is just basic *nix stuff. HTH, -- Hassan Schroeder hassan.schroe...@gmail.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] Problem with Regular Expression
Why would the following regular expression produce the results below? input: john,doe,"1,200.99",training,12345 code executed on input: values = line.split(/("\d*,\d+\.\d*")|,/) output: ["john","doe","","1,200.99","","training","12345"] What's up with the two empty array indexes that are generated during the split surrounding my dollar value? The regular expression is pretty explicit and the input string doesn't contain anything that should cause them when run through the expression, yet there they are so obviously I'm doing something wrong in my regexp. 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: mySQL setup - I'm losing it here.
Hello Ryan, > bio4054059:depot rmorourk$ mysql -uroot depot_development > -bash: mysql: command not found "command not found" is your shell telling you that whatever directory you have installed mysql in to is not on your search path. If you type "print $PATH" you will see a colon separated ordered list of directories that are searched for executable commands. To temporarily extend the list just type: set PATH=MYSQLHOME:$PATH where MYSQLHOME is the full path to the directory containing mysql executable. i.e. MSQLHOME might be /usr/local/mysql/bin. You should then be able to execute the mysql -uroot... command. Once you have success with this, you should modify your shell startup file to make the PATH change permanent. Depending on what shell you use this could be .profile, .cshrc, .tshrc, ... Rick > I get the error on the second line --- any advise? I assume this has to > be a issue of im not telling something to look in the right somewhere, > but I am about ready to put my fist in the wall on this thing. I would > LOVE some advise! > > Thanks!! > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: MySpace.com clone using Ruby on Rails. Is it possible?
Lekvarnik Lekvarnik wrote: > Thx for your quick reply, but the most important thing for me personally > is that, if for example chosing Drupal 6.x with CivicSpace extension is > better than building app from scratch using Ruby on Rails or other > framework. > > Its important the loading of the page, core files, libs aso. Is drupal > faster , in generall than ruby on rails or Symfony? > > And I want to know if Ruby on Rails is good for myspace.clone /my site > is a community website for people with the same interest - for these > kind of people people there is in my country no alternative on the net > yet/ Understood. I just wanted to try to guide your thinking a little bit away from the technical and help you to focus on the needs of your audience. As for me, I'm a developer so I tend to ignore canned solutions to problems. Unless there exist a canned solution that does exactly what I want. From my experience it's often easier to build everything myself as opposed to attempting to extend something to suit my particular needs. I can give you no feedback on Drupal. I've never used it, nor even seen it. I've never had the need and I tend to ignore things I don't need. The whole "built-it" or "buy-it/use-it" question is always tough. At least in my experience. I don't think there is a black-and-white answer to this question. The systems I'm involved in a so large in scale that we end up with a combination of all of that. I use some plugins and gems to take care of some common solutions. But, they almost never do things exactly as I would like. Sometimes I can live with it, and work around it. Other times I end up throwing them out and rolling my own solution. If you're looking for a definitive answer on this forum, I'm afraid you're not going to be satisfied with any answer. The only truthful answer is that "it depends." In order to answer these seemingly simple questions would require extensive details of you application's specifications. It just seems to me like you're "putting the cart before the horse." You need a clear understanding of your requirements, and a clear understanding of the needs of you audience. Next you need to find out who will be building your application. Choosing that person, or company, should be done independently of what framework they may prefer. Only then should you work with your developers to figure out what the best solution should be. -- 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] Processing uploaded XML file
Hi all Sorry if this seems silly, only been learning Ruby and Rails for 2 weeks, though I have been programming since the Commodore 64 came out. I need to process an XML file once it is uploaded (currently using paperclip). The problem is that the files can be quite slow to process, up to 30 seconds for some. Once this processing is done, I need to save that data to the model to which the file is attached. So my question is, where is the best place to call the processing function from? Will the processing block mongrel? Should it go in a new thread? If so, how do I do that? And is there any speedier Library than REXML for processing XML? Thanks for your help Marc --~--~-~--~~~---~--~~ You received 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 -~--~~~~--~~--~--~---