Re: [Rails] Re: Redirect to edit form after update
Le 1 décembre 2010 18:12:01 UTC+2, Leonel *.* a écrit : > ALRIGHT!! AWESOME!!! > > Simple and it works! > > I did this... > > flash[:notice] = 'User was successfully updated.' > respond_to do |format| > if @user.update_attributes(params[:user]) >format.html { redirect_to(:action => 'edit') } >format.xml { head :ok } > else > ... > > Thanks Colin! > I have come in this conversion late but I can still contribute. You may wish to know whether the user was sucessfully updated or not. So I guess (1) your flash[:notice] is ill-positioned, and (2) you need to have an "error dispatcher" too. In addition, I am not sure if you "really" want to conditional processing of HTTP (I mean do you really need to specify that the application should respond to html format?). But combining the solutions above (from the previous threads) plus my changes, we have the following: 1. In you controller: respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = 'User was successfully updated.' format.html { redirect_to(:action => 'edit' ) } else flash[:error] = 'User was not updated.' format.html { redirect_to(:action => 'edit' ) } end end 2. In your layout, you may wish to add the following lines to track the "flash" messages: <%= flash[:notice] %> <%= flash[:error] %> More blessings, --- Edmond Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) | Malawi Cell: +265 999 465 137 | +265 881 234 717 *"Leading the Improvement of Health through Information and Communication Technology in the Developing World" The **Creed* of *Baobab Health * -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Set-Cookie in rails 2 and rails 3
I noticed that rails 2 sets the session ID cookie on every rails- served request, whereas rails 3 only sets the session ID when the session is established. Anybody know why that might be? I've had a recurring issue with users losing their session cookie inexplicably in Safari on a rails 3 app. This never happened with the rails 2 version, and I just noticed the constant resetting of the session cookie. This seems like a clue. Thanks, Eric -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] persisting complex (and possibly large) objects
This question may be so obvious that even Marnen won't answer it... :) I need to store a set of relatively complex objects in the db -- in my case, these are discrete cumulative distribution functions: they take a long time to construct, but I want the lookup to be fast. Since the lookup is essentially a binary search, a B-Tree or some variant would be a sensible data structure. I have choices: (a) I store entire YAML'd B-Trees, (b) I store simple data structure (e.g. arrays of numeric pairs) and spend time constructing a B-Tree from it, or (c) choose another approach that someone on this list points out. Can this forum offer any advice on size / speed tradeoffs for YAML'd objects? If unpacking a YAML'd object is fast, then (a), storing the entire B-Tree is probably the best approach. If slow, then perhaps I'm better off with (b), storing a minimal data structure and reconstructing the B-Tree when I need it. Thoughts? - ff -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Lazy loading issue (I think) - what's up with this ?
I have three models: (1) Mood (2) User (3) Mymood Mymood belongs_to mood Mymood belongs_to user User has_many mymoods I have a function in User, like this: def moods if mymoods.empty? [] else mymoods.collect{|mm| mm.mood} end end In Rails2, User.first.moods returns an array of moods (or an empty array where there are none) In Rails3, I get a big old error: uninitialized constant Mymood::Mood I'm guessing it's something to do with lazy loading, because if I call (in the console) User.first.mymoods then User.first.moods it all works as it should, but if I just call on its own: User.first.moods I get the error above Any guidance gratefully received! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: JSON Builder for Rails?
it's not exactly like rxml but should do the job: https://github.com/inem/tequila -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Having trouble with CanCan
Nevermind, I found the problem. I was supposed to remove the @ because it's iterating from a loop: <% @users.each do |user| %> <% if user.first_name.nil? or user.last_name.nil? user_link = link_to 'User Details', user, :class=>'first_and_last_name' else user_link = link_to user.first_name + ' ' + user.last_name, user, :class=>'first_and_last_name' end %> <% user_name = user.first_name.to_s + ' ' + user.last_name.to_s %> <%= link_to user_name, edit_user_path(user) %> <%= user.title %> <%= user.email %> <% if user.role == 'admin' %> <%= user.role %> <% end %> <% if can? :update, user %> <%= link_to 'Edit', edit_user_path(user) %> <%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %> <% end %> <% end %> -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Having trouble with CanCan
So I got CanCan and Devise working well. I have two types of users: Admins and Nonadmins. Admins can edit all of Nonadmins profiles. The problem is, every user (either Admin or Nonadmin) belongs to an Account or Organization. Admins should only be able to edit users from their own Account or Organization. I was able to do that too. The problem is, I can't display the links to the edit buttons. Everything seems fine, I don't see any errors. Here is what I have in ABILITY.RB --- if user.role == "admin" # can :manage, :all can :manage, Account do |account| account.try(:id) == user.account_id end can :manage, Appointment can :manage, Client can :manage, Service can :manage, User do |u| u.try(:account_id) == user.account_id end elsif user.role == "employee" --- this is what I have on the file that lists the users: --- <% if can? :update, @user %> <%= link_to 'Edit', edit_user_path(user) %> <%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %> <% 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: rvm and gem confusion
Besides rvm and the gem directory there I have a .gemrc in my home directory and a .gem directory. Not sure why I have it there. It stops my installation of Rails 3, complaining about permissions of the .gemrc. Is that something I've created or has it to do with Mac OS Snow Leopard? That is, can I delete them? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Hello I'm looking to learn how to redirect all non-www (mysite.com) to https://www.mysite.com I tried the following: class ApplicationController < ActionController::Base before_filter :check_uri def check_uri redirect_to request.protocol + "www." + request.host_with_port + request.request_uri if !/^www/.match(request.host) if Rails.env == 'production' end Problem with this is since the SSL cert on Heroku is for www.mysite.com, and not mysite.com, the browser throws the nasty SSL HTTPS invalid warning. Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs invalid warning? 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Develop Facebook app using rail
facebooker On Wed, Dec 1, 2010 at 2:41 PM, ratnamraj varasala wrote: > facebooker > > On Wed, Dec 1, 2010 at 5:01 PM, ashu wrote: >> >> hello >> >> please tell me the way to develop facebook app by rails need to which >> is good tool available now >> >> facebooker , rfacebook ,mini_fb >> >> and how to do post on users wall, email user , or send message to >> user >> >> Any link , notes , tutorials , blog >> >> 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-t...@googlegroups.com. >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: How to test sort order in named (or default) scope
Colin Law wrote in post #965538: > On 1 December 2010 20:15, Marnen Laibow-Koser > wrote: >> in the correct order, then your sorting is correct. > Probably. I may be wrong but I believe that postgreSQL does not even > guarantee that an unordered query will produce the same results if the > same query is run twice. Right, SQL databases cannot be assumed to guarantee this. That's why I suggested creating the factories in an arbitrary order, different from what you want to see. > Conceivably therefore I could test without > the order clause and check it fails, then, thinking I had added the > order clause re-run the test and find it pass. I think though as I > said in an earlier post that I can use common sense and assume the > probability of this is so small as to be insignificant. Well, if you create the factories in order, then there's a significant probability of this happening... Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Re: rvm and gem confusion
On Wed, Dec 1, 2010 at 2:58 PM, Robert Walker wrote: > Paul Bergstrom wrote in post #965521: > > David Kahn wrote in post #965487: > > > >> I think this is right... also I would recommend you trying to use > >> gemsets -- > > > > Yes, I've realized that's the way to go. Trying to figure out how to do > > it. Thanks. > > Once you get your gemsets configured look into using .rvmrc files in > your projects to automate the switching of your environment. > > rvm gemset create my_gemset > > rvm use 1@my_gemset > > my_project > --> .rvmrc > -- > rvm 1@my_gemset > Nice! Then that is my next step and I am getting tired of typing rvm etc in every terminal window I open. > > http://rvm.beginrescueend.com/workflow/rvmrc/ > > And don't forget to set your default interpreter: > > http://rvm.beginrescueend.com/rubies/default/ > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: How to test sort order in named (or default) scope
On 1 December 2010 20:15, Marnen Laibow-Koser wrote: > Colin Law wrote in post #965435: >> Hi >> I have a named scope that sets a sort order. In my unit test I can >> run the query on a set of records (using Factory or fixtures) and >> check the sort order is correct. I believe though that a find without >> an explicit sort order may return the records in any order, so how can >> I be sure that it is not just accidental that they are in the correct >> order? > > Try creating the factories in a weird order. If they still are returned > in the correct order, then your sorting is correct. Probably. I may be wrong but I believe that postgreSQL does not even guarantee that an unordered query will produce the same results if the same query is run twice. Conceivably therefore I could test without the order clause and check it fails, then, thinking I had added the order clause re-run the test and find it pass. I think though as I said in an earlier post that I can use common sense and assume the probability of this is so small as to be insignificant. > > ...or... > > Write the test so that it checks that the appropriate :order clause is > set. This is probably too invasive and implementation-dependent for my > taste, though I might do it occasionally. I agree this seems like overkill and would likely be fragile. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: How to test sort order in named (or default) scope
On 1 December 2010 19:56, Frederick Cheung wrote: > > > On Dec 1, 5:22 pm, "Andrew M. Kasper" > wrote: >> > I have a named scope that sets a sort order. In my unit test I can >> > run the query on a set of records (using Factory or fixtures) and >> > check the sort order is correct. I believe though that a find without >> > an explicit sort order may return the records in any order, so how can >> > I be sure that it is not just accidental that they are in the correct >> > order? >> >> Colin: >> >> I would argue that it's unimportant -- even at the unit-level -- *how* >> the test is passing. If every time you run the test it passes, then >> the code does what you specify it does. When there's a problem, >> identify the bug and write a new unit, integration, or functional test >> that eliminates the unexpected behavior, then make that test pass. >> >> I might also argue that it's not up to you to test ActiveRecord. You >> might assert that your named scope is passing the correct sorting >> parameters to ActiveRecord; at that point, it's up to ActiveRecord to >> hold up its end of the bargain. >> > > I'd add that something that may give you some comfort is to endeavour > to write a failing test first. Absolutely, I will check that the test fails before adding the order clause, but see my reply to Marnen below. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: rvm and gem confusion
Robert Walker wrote in post #965531: > > Once you get your gemsets configured look into using .rvmrc files in > your projects to automate the switching of your environment. > > rvm gemset create my_gemset > > rvm use 1@my_gemset > > my_project > --> .rvmrc > -- > rvm 1@my_gemset > > http://rvm.beginrescueend.com/workflow/rvmrc/ > > And don't forget to set your default interpreter: > > http://rvm.beginrescueend.com/rubies/default/ 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: rvm and gem confusion
Paul Bergstrom wrote in post #965521: > David Kahn wrote in post #965487: > >> I think this is right... also I would recommend you trying to use >> gemsets -- > > Yes, I've realized that's the way to go. Trying to figure out how to do > it. Thanks. Once you get your gemsets configured look into using .rvmrc files in your projects to automate the switching of your environment. rvm gemset create my_gemset rvm use 1@my_gemset my_project --> .rvmrc -- rvm 1@my_gemset http://rvm.beginrescueend.com/workflow/rvmrc/ And don't forget to set your default interpreter: http://rvm.beginrescueend.com/rubies/default/ -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: How to test sort order in named (or default) scope
On 1 December 2010 17:22, Andrew M. Kasper wrote: >> I have a named scope that sets a sort order. In my unit test I can >> run the query on a set of records (using Factory or fixtures) and >> check the sort order is correct. I believe though that a find without >> an explicit sort order may return the records in any order, so how can >> I be sure that it is not just accidental that they are in the correct >> order? > > I would argue that it's unimportant -- even at the unit-level -- *how* > the test is passing. If every time you run the test it passes, then > the code does what you specify it does. When there's a problem, > identify the bug and write a new unit, integration, or functional test > that eliminates the unexpected behavior, then make that test pass. I don't think that is a valid argument. I think effectively what you are saying is that it doesn't matter if it actually tests what it is supposed to as long as it passes. If you later discover that the app is not doing what it is supposed to then add more tests. > > I might also argue that it's not up to you to test ActiveRecord. You > might assert that your named scope is passing the correct sorting > parameters to ActiveRecord; at that point, it's up to ActiveRecord to > hold up its end of the bargain. I am not trying to test that ActiveRecord sorts correctly, I am trying to test that I have correctly coded the scope. I don't know how I would assert that the named scope is passing the correct sorting params. Can you enlighten me? I think what I will do is use some common sense rather than being too pedantic about the testing. By creating a number of records in a random order and then checking that they are sorted correctly I think the possibility of accidentally finding them come back in sorted order is negligible. In addition I will have checked that the test fails before I add the sort clause. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: rvm and gem confusion
David Kahn wrote in post #965487: > I think this is right... also I would recommend you trying to use > gemsets -- Yes, I've realized that's the way to go. Trying to figure out how to do it. 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Missing template home/index after update to Rails 3
adamwtw wrote in post #943033: > I noticed that if I rename the index.html.erb to index.en.html.erb, it > works. So I guess I should tell rails to use an "empty" locale when > looking for templates? > > Also, I'musing JRuby. > > Adam I actually have the same issue right now. Template is missing Missing template authorize/login with {:handlers=>[:erb, :builder, :rjs, :rhtml, :rxml], :locale=>[:en, :en], :formats=>[:html]} in view paths... even though it exists in the plugin path, it cannot find it :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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: rvm and gem confusion
Robert Walker wrote in post #965446: > Paul Bergstrom wrote in post #965326: >> Maybe I should start over. If I uninstall rvm will that mean I get rid >> of the installed rvm gems as well? I presume so. Can I just delete the >> .rvm directory? > > AFAIK everything related to RVM is stored inside ~/.rvm. I've > reinstalled before by simply deleting the directory and reinstalling. > I was able to delete all in my previous location. Now I can start over using rvm. > If you want to know details about your RVM environment use... > > rvm info > > It will tell you where to find the gem folder and exactly what gemset > you're using. All of this information can be found in the RVM docs on > their web site. Thanks. Everything seems to be ok now, kept in rvm. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Error installing rails 3, get error: mail requires i18n (~> 0.4.1, runtime)
The short answer: My guess: I had installed ruby and rails about two weeks apart. I believe they were out of synch with each other, hence the problem. I uninstalled all my ruby gems including rails and reinstalled them one after the other and they all work now. The long Answer: I would like to thank all of you who responded and made sensible suggestions. I tried almost all of them. Indeed, somehow I ended up with two versions of i18n gem and by removing the more recent version and rerunning the command “gem install rails” it did seem to complete the installation without error. However, nothing would work properly. Something’s worked yet others things did not. For example when I generated a new rails project the directory contained only two files and not the whole subdirectory structure that was supposed to be created. The solution: I successfully uninstalled ruby by using control panel’s ADD/REMOVE option. Yet, my original ruby directory was still there which included some subdirectory and files. I removed that directory as well. I reinstalled Ruby and rails again. This time all went smoothly and nothing went wrong. It seems everything is working now. My guess is that since my installation of ruby and rails were two weeks apart, ruby gem and rails gem were out of synch. So by removing my entire ruby related gems/apps and reinstalling them one right after the other may have done the trick. Again thank you all for your help. Mike -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to test sort order in named (or default) scope
Colin Law wrote in post #965435: > Hi > I have a named scope that sets a sort order. In my unit test I can > run the query on a set of records (using Factory or fixtures) and > check the sort order is correct. I believe though that a find without > an explicit sort order may return the records in any order, so how can > I be sure that it is not just accidental that they are in the correct > order? Try creating the factories in a weird order. If they still are returned in the correct order, then your sorting is correct. ...or... Write the test so that it checks that the appropriate :order clause is set. This is probably too invasive and implementation-dependent for my taste, though I might do it occasionally. > > Colin Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to test sort order in named (or default) scope
On Dec 1, 5:22 pm, "Andrew M. Kasper" wrote: > > I have a named scope that sets a sort order. In my unit test I can > > run the query on a set of records (using Factory or fixtures) and > > check the sort order is correct. I believe though that a find without > > an explicit sort order may return the records in any order, so how can > > I be sure that it is not just accidental that they are in the correct > > order? > > Colin: > > I would argue that it's unimportant -- even at the unit-level -- *how* > the test is passing. If every time you run the test it passes, then > the code does what you specify it does. When there's a problem, > identify the bug and write a new unit, integration, or functional test > that eliminates the unexpected behavior, then make that test pass. > > I might also argue that it's not up to you to test ActiveRecord. You > might assert that your named scope is passing the correct sorting > parameters to ActiveRecord; at that point, it's up to ActiveRecord to > hold up its end of the bargain. > I'd add that something that may give you some comfort is to endeavour to write a failing test first. 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
>> What's the issue? > > The issue isn't really the filenames directly, but that URLs cannot > contain spaces. [snip] > > -Rob Rob and Hassan and all ... I don't believe it ... but you were right. Replacing the spaces with hyphens every and ... everything works. Wow. I thought I was chasing a wild good but instead I found the goose that lays the HTML eggs. Thanks Ralph -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: rvm and gem confusion
On Wed, Dec 1, 2010 at 11:16 AM, Robert Walker wrote: > Paul Bergstrom wrote in post #965326: > > Maybe I should start over. If I uninstall rvm will that mean I get rid > > of the installed rvm gems as well? I presume so. Can I just delete the > > .rvm directory? > > AFAIK everything related to RVM is stored inside ~/.rvm. I've > reinstalled before by simply deleting the directory and reinstalling. > I think this is right... also I would recommend you trying to use gemsets -- I have found that making a gemset for each of my apps has been working nicely, and makes them easy to find, i.e. .rvm/gems/ruby-1.9.2...@wavelineup3/gems Where wavelineup3 is the gemset I created under ruby-1.9.2-p0 installation for one of my apps. See: http://rvm.beginrescueend.com/gemsets/creating/ > > If you want to know details about your RVM environment use... > > rvm info > > It will tell you where to find the gem folder and exactly what gemset > you're using. All of this information can be found in the RVM docs on > their web site. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Can't install PG gem
On Tue, Nov 30, 2010 at 1:02 PM, Chris Lemcke wrote: > I'm running ruby 1.8.7 on rvm, and I'm trying to install the pg gem. > I've used macports to install postgresql 8.3. I'm running on a > dual-core mac. I try installing the pg gem with this command: (all > directories are not empty) > > > env ARCHFLAGS="-arch x86_64" gem install pg -- > --with-pgsql-lib=/opt/local/lib/postgresql83 > --with-pgsql-include=/opt/local/include/postgresql83/ > (I've also tried w/the i386 flag) > > Here's the response: > > checking for pg_config... yes > MacOS X build: fixing architecture flags: > using the value in ARCHFLAGS environment variable ("-arch x86_64"). > checking for libpq-fe.h... yes > checking for libpq/libpq-fs.h... yes > checking for PQconnectdb() in -lpq... no > checking for PQconnectdb() in -llibpq... no > checking for PQconnectdb() in -lms/libpq... no > Can't find the PostgreSQL client library (libpq) > *** extconf.rb failed *** > Could not create Makefile due to some reason, probably lack of > necessary libraries and/or headers. Check the mkmf.log file for more > details. You may need configuration options. > These are my notes on getting pg to install on rvm -- I think the big deal was to make sure you are pointing to the actual bin directory of postgres, wherever it happens to be installed, so you might need to change the directory: PATH=/library/postgresql/8.4/bin:$PATH gem install pg --no-rdoc --no-ri (note - the path is to the postgres server bin) > > > Any suggestions? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Update div with Prototype
I want to update the div (datos), the title works well. I don't know why the option "remote => true" does not works. A greeting. 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Rails 3 load order?
Does anyone have a link or something on what is the difference on how things load up in rails 3 compared to rails 2.3.5? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Update div with Prototype
On Dec 1, 2010, at 12:45 PM, pepe wrote: The title variable is to change the title when the page is refreshed. I believe you are a little lost about how the whole thing works. At first you said you wanted to change the contents of 'datos' but now you say you want to change the contents of the tag . I'll assume from now on it is the later. <%= title %> I think there is a typo in your code. Shouldn't it be <%= @title %>?. Besides that, I have never tried to replace the contents of an element in the section so I'm not sure it will work. I'd appreciate if you let me know when you get your code working. For your code to work you would have to give an id to the element you want to replace, as in: <%= @title %> The raw Prototype code to update the content of the title tag (without ID) is as follows: $$('title').first().update('Foo bar baz'); Perhaps you can modify your script to make that call. Walter Then it might be a good idea to create a partial and render it to replace the contents of the tag , although returning just a string might be OK. You would also need to tell your 'link_to' helper which HTML element to replace ('title' in this case) and as I explained before I couldn't see how to do that by looking at the API with Rails 3. Somebody else already using Rails 3 might be able to help better than me there. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails- t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en . -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Nested has_many :through problem with Rails 3
On Dec 1, 10:43 am, Daniel Berger wrote: > On Nov 19, 1:23 pm, "Alex V." wrote: > > > I am experiencing the same problem as daniel > > > - has_many through association > > > - get invalid sql when try to use a scope with "select distinct": > > basically, the "select" i specify does not override the default implicit > > select of the has_many join, but instead gets appended to it (as in > > daniel's example) > > > Does anyone know if this is by design, or a bug? > > I'm guessing bug. As of Arel 2.0.6 I'm no longer getting invalid sql, > but I'm not getting valid results either. Disregard, it's still generating invalid sql. Dan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Update div with Prototype
> The title variable is to change the title when the page is refreshed. I believe you are a little lost about how the whole thing works. At first you said you wanted to change the contents of 'datos' but now you say you want to change the contents of the tag . I'll assume from now on it is the later. <%= title %> I think there is a typo in your code. Shouldn't it be <%= @title %>?. Besides that, I have never tried to replace the contents of an element in the section so I'm not sure it will work. I'd appreciate if you let me know when you get your code working. For your code to work you would have to give an id to the element you want to replace, as in: <%= @title %> Then it might be a good idea to create a partial and render it to replace the contents of the tag , although returning just a string might be OK. You would also need to tell your 'link_to' helper which HTML element to replace ('title' in this case) and as I explained before I couldn't see how to do that by looking at the API with Rails 3. Somebody else already using Rails 3 might be able to help better than me there. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Nested has_many :through problem with Rails 3
On Nov 19, 1:23 pm, "Alex V." wrote: > I am experiencing the same problem as daniel > > - has_many through association > > - get invalid sql when try to use a scope with "select distinct": > basically, the "select" i specify does not override the default implicit > select of the has_many join, but instead gets appended to it (as in > daniel's example) > > Does anyone know if this is by design, or a bug? I'm guessing bug. As of Arel 2.0.6 I'm no longer getting invalid sql, but I'm not getting valid results either. Dan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Can't install PG gem
I really need help with this. Does anyone have any suggestions? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
On Dec 1, 2010, at 12:25 PM, Ralph Shnelvar wrote: OMG. Do you actually have spaces in your image file names? -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan Yes ... why not? I have not had any troubles with spaces in file names on my Windows development environment, Linux static web page environment, or Linux RoR environment. What's the issue? The issue isn't really the filenames directly, but that URLs cannot contain spaces. Depending on where the space occurs, it should be encoded either as %20 (in the path portion) or as + (in the query- string portion). In my experience, even using + rather than %20 in path components (such as your filename) will work properly even though it might not be strictly correct per some RFC. -Rob Rob Biedenharn r...@agileconsultingllc.com http://AgileConsultingLLC.com/ r...@gaslightsoftware.com http://GaslightSoftware.com/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
On Dec 1, 2010, at 12:25 PM, Ralph Shnelvar wrote: Yes ... why not? I have not had any troubles with spaces in file names on my Windows development environment, Linux static web page environment, or Linux RoR environment. What's the issue? A URL must not contain spaces, which is why browsers will silently fill in %20 to replace them whenever they encounter a badly-coded URL. Seriously, deep in the bowels of the Internet World Domination Headquarters, Tim Berners-Lee kills a kitten each time you put spaces in a URL. Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
On Wed, Dec 1, 2010 at 9:25 AM, Ralph Shnelvar wrote: > I have not had any troubles with spaces in file names on my Windows > development environment, Linux static web page environment, or Linux RoR > environment. > > What's the issue? You just found it -- or at least one -- apparently :-) Spaces in file or directory names are brittle -- some programs will handle them OK, some won't. You're far better off avoiding them. -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
> OMG. Do you actually have spaces in your image file names? > > -- > Hassan Schroeder hassan.schroe...@gmail.com > twitter: @hassan Yes ... why not? I have not had any troubles with spaces in file names on my Windows development environment, Linux static web page environment, or Linux RoR environment. What's the issue? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to test sort order in named (or default) scope
> I have a named scope that sets a sort order. In my unit test I can > run the query on a set of records (using Factory or fixtures) and > check the sort order is correct. I believe though that a find without > an explicit sort order may return the records in any order, so how can > I be sure that it is not just accidental that they are in the correct > order? Colin: I would argue that it's unimportant -- even at the unit-level -- *how* the test is passing. If every time you run the test it passes, then the code does what you specify it does. When there's a problem, identify the bug and write a new unit, integration, or functional test that eliminates the unexpected behavior, then make that test pass. I might also argue that it's not up to you to test ActiveRecord. You might assert that your named scope is passing the correct sorting parameters to ActiveRecord; at that point, it's up to ActiveRecord to hold up its end of the bargain. What do you think of that? Andrew M. Kasper -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Update div with Prototype
The title variable is to change the title when the page is refreshed. What you're doing with link_to_remote is what I want it. The problem is that Rails 3 does not work the "remote => true" in the "link_.to" and is supposed to be the equivalent of link_to_remote in Rails 2. And if I remove the option of remote: true, refreshes the entire page and not the HTML element that I want, in this case datos div. Thank you. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: rvm and gem confusion
Paul Bergstrom wrote in post #965326: > Maybe I should start over. If I uninstall rvm will that mean I get rid > of the installed rvm gems as well? I presume so. Can I just delete the > .rvm directory? AFAIK everything related to RVM is stored inside ~/.rvm. I've reinstalled before by simply deleting the directory and reinstalling. If you want to know details about your RVM environment use... rvm info It will tell you where to find the gem folder and exactly what gemset you're using. All of this information can be found in the RVM docs on their web site. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
On Wed, Dec 1, 2010 at 9:01 AM, Ralph Shnelvar wrote: > HTTP parse error, malformed request (127.0.0.1): > # > > REQUEST DATA: "GET /images/Logo 010 - 200x48 - no > background.png?1289857922 > PARAMS: {"REQUEST_PATH"=>"/images/Logo", "REQUEST_URI"=>"/images/Logo", > "REQUEST_METHOD"=>"GET"} OMG. Do you actually have spaces in your image file names? -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
I just installed my RoR application on my ISP's server. This is a Cpanel environment and it creates a .htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^xyz.com$ [OR] RewriteCond %{HTTP_HOST} ^www.xyz.com$ RewriteRule ^(.*)$ "http\:\/\/127\.0\.0\.1\:12001\/$1" [P,L] in a public_html directory. (I changed my domain name in the text above to xyz because we are not ready to do a product launch.) The objective, I guess, of the .htaccess file in public_html is to rewrite (i.e. redirect) www.xyz.com to 127.0.0.1:12001 When I access my website using www.xyz.com:12001 everything works fine. All my pictures show up, all links work, there are no errors in production.log and the only error I see in mongrel.log is Rails signals registered. HUP => reload (without restart). It might not work well. But that message only occurs during mongrel startup. When I attempt to access my website via www.xyz.com or xyz.com I get a ton of mongrel errors complaining that HTTP parse error, malformed request (127.0.0.1): # REQUEST DATA: "GET /images/Logo 010 - 200x48 - no background.png?1289857922 HTTP/1.1\r\nHost: 127.0.0.1:12001\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E)\r\nAccept: image/png,image/*;q=0.8,*/*;q=0.5\r\nAccept-Language: en-us,en;q=0.5\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nReferer: http://www.xyz.com/\r\nCookie: _XYZ_session=BAh7BjoPc2Vzc2lvbl9pZCIlOTZlZTVmMjUxOGE3YmIwMGEzNTQ5M2QzZDYwMDI4NmE%3D--fbeb1fb7b16f82da9485523bb84ad3b60fd8d6dc\r\nMax-Forwards: 10\r\nX-Forwarded-For: 98.245.93.82\r\nX-Forwarded-Host: www.xyz.com\r\nX-Forwarded-Server: xyz.com\r\n\r\n" --- PARAMS: {"REQUEST_PATH"=>"/images/Logo", "REQUEST_URI"=>"/images/Logo", "REQUEST_METHOD"=>"GET"} - - - - - - - - - I don't even know where to begin to look to solve this problem so I would appreciate any pointers. Am I missing some route.rb statement that needs to handle 127.0.0.1:12001 ? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Redirect to edit form after update
On Dec 1, 11:12 am, "Leonel *.*" wrote: > ALRIGHT!! AWESOME!!! > > Simple and it works! > > I did this... > > flash[:notice] = 'User was successfully updated.' > respond_to do |format| > if @user.update_attributes(params[:user]) > format.html { redirect_to(:action => 'edit') } > format.xml { head :ok } > else There is a shorthand for specifying the "notice" flash in the redirect_to call. You were very close to having it correct. The format is this: redirect_to(options = {}, response_status = {}) The :notice needs to be in the response_status hash. The problem you had is that that :action and :notice were both passed in the options hash. You can use the shorthand by explicitly separating the hashes: redirect_to( { :action => 'edit' }, :notice => 'User was successfully updated.' ) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to test sort order in named (or default) scope
Hi I have a named scope that sets a sort order. In my unit test I can run the query on a set of records (using Factory or fixtures) and check the sort order is correct. I believe though that a find without an explicit sort order may return the records in any order, so how can I be sure that it is not just accidental that they are in the correct order? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Redirect to edit form after update
ALRIGHT!! AWESOME!!! Simple and it works! I did this... flash[:notice] = 'User was successfully updated.' respond_to do |format| if @user.update_attributes(params[:user]) format.html { redirect_to(:action => 'edit') } format.xml { head :ok } else ... Thanks Colin! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Redirect to edit form after update
On 1 December 2010 15:39, Leonel *.* wrote: > By default, the controllers are coded in a way that you will be > redirected to the SHOW page of the item you are updating. > > For example, if I edit a user, after I click the submit button, I will > be redirected to the SHOW page of that users. > > Instead of being redirected to the SHOW page, I want to stay in the same > EDIT page with a notice that the user has been updated. How can I > accomplish that? > > I tried this... > format.html { redirect_to(:action => 'edit' , :notice => 'User was > successfully updated.') } You don't want the :notice bit, just make sure that the flash is shown on the edit page as it is on the show page. Probably something like <%= flash[:notice] %> in the layout. and set flash[:notice] in the update action (which it probably is already). Colin > > And it did get me redirected to the EDIT form. But I don't see the > notice message and the resulting URL is this: > http://localhost:3000/users/4/edit?notice=User+was+successfully+updated. > > So I must be doing something wrong. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Redirect to edit form after update
By default, the controllers are coded in a way that you will be redirected to the SHOW page of the item you are updating. For example, if I edit a user, after I click the submit button, I will be redirected to the SHOW page of that users. Instead of being redirected to the SHOW page, I want to stay in the same EDIT page with a notice that the user has been updated. How can I accomplish that? I tried this... format.html { redirect_to(:action => 'edit' , :notice => 'User was successfully updated.') } And it did get me redirected to the EDIT form. But I don't see the notice message and the resulting URL is this: http://localhost:3000/users/4/edit?notice=User+was+successfully+updated. So I must be doing something wrong. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Update div with Prototype
Hi, I have not used Rails 3 yet and I see by your link_to helper that's what you are using. Sorry if I can't be of much help, but I'll try to point out what I see here that _could_ be wrong. div class="menu_activado"> <% = link_to "Link", about_path,: remote => true%> I am assuming the first div is missing the opening '<' because of a mistake while copying the code? A quick look at the Rails 3 API does not show how to indicate that you want to update an HTML element's contents. Compare the link above with the following, based on Rails 2.3.5: <%= link_to_remote 'Get Time', :update => 'current_time', :url => {:action => 'get_time' }, :complete => visual_effect(:hightlight_shake, :current_time) %> Notice the :update line? It indicates what HTML element to update with the contents returned by the server. I can't see in the Rails 3 API how to do that. Maybe it's explained somewhere else but not in the link_to helper docs, as far as I could see. > > <%= render 'layouts/header' %> > > <%= yield %> > > <%= render 'layouts/footer' %> > > I am not sure you really want to replace the contents of 'datos'. That would replace the contents of the whole page except for the header and the footer. > class PagesController < ApplicationController > def about > @title = "About" > end > end >From the link_to_remote Rails 2.3.8 API: "Returns a link to a remote action defined by options[:url] (using the url_for format) that’s called in the background using XMLHttpRequest. The result of that request can then be inserted into a DOM object whose id can be specified with options[:update]. Usually, the result would be a partial prepared by the controller with render :partial." The last sentence is the important one. Your 'about' action does not render anything, it only assigns a value to a variable. The returned value of your action will be the string 'About' and that should be what you get in 'datos' after the code executes, supposing that the div gets updated. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Prawn : undefined method `make_table'
2010/12/1 Venkat Surabhi > require 'prawn' > require 'prawn/core' > require 'prawn/layout' > > Prawn::Document.new do |pdf| >subtable = pdf.make_table([[ "foo", "bar" ], [ "baz", "bax" ]], > :column_widths => [ 50, 50 ]) { >column(0).background_color = "808080" >cells.borders = [] >} > >table = pdf.make_table([[ "foo", "bar" ], [ "baz", subtable ]], > :column_widths => [ 100, 100 ]) { >cells.border_width = 5 >} >table.draw > end > > When i execute the above code i am getting below mentioned error: > > > > e:/ruby/lib/ruby/gems/1.8/gems/prawn-core-0.8.4/lib/prawn/graphics/color.rb:72:i > n `method_missing': undefined method `make_table' for > # 0> (NoMethodError) >from border.rb:6 >from > e:/ruby/lib/ruby/gems/1.8/gems/prawn-core-0.8.4/lib/prawn/document. > rb:238:in `[]' >from > e:/ruby/lib/ruby/gems/1.8/gems/prawn-core-0.8.4/lib/prawn/document. > rb:238:in `initialize' >from border.rb:5:in `new' >from border.rb:5 > > > In apis it is mentioned that Prawn::Document object has method > make_table. > > I notice you are using prawn 0.8.4. This method make_table does not exist in prawn 0.8.4. You need to upgrade to something like prawn 0.10.2 and higher. If you have more prawn related questions, there also exists a prawn forum: prawn-ruby[AT]googlegroups[DOT]com, which can help you more. Thanks, --- Edmond Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) | Malawi Cell: +265 999 465 137 | +265 881 234 717 *"Leading the Improvement of Health through Information and Communication Technology in the Developing World" The **Creed* of *Baobab Health * > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Prawn : undefined method `make_table'
require 'prawn' require 'prawn/core' require 'prawn/layout' Prawn::Document.new do |pdf| subtable = pdf.make_table([[ "foo", "bar" ], [ "baz", "bax" ]], :column_widths => [ 50, 50 ]) { column(0).background_color = "808080" cells.borders = [] } table = pdf.make_table([[ "foo", "bar" ], [ "baz", subtable ]], :column_widths => [ 100, 100 ]) { cells.border_width = 5 } table.draw end When i execute the above code i am getting below mentioned error: e:/ruby/lib/ruby/gems/1.8/gems/prawn-core-0.8.4/lib/prawn/graphics/color.rb:72:i n `method_missing': undefined method `make_table' for # (NoMethodError) from border.rb:6 from e:/ruby/lib/ruby/gems/1.8/gems/prawn-core-0.8.4/lib/prawn/document. rb:238:in `[]' from e:/ruby/lib/ruby/gems/1.8/gems/prawn-core-0.8.4/lib/prawn/document. rb:238:in `initialize' from border.rb:5:in `new' from border.rb:5 In apis it is mentioned that Prawn::Document object has method make_table. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] What is "Ruby on Rails" in your Language?
In Tamil language, ரயிலின் மீது ரூபி - read as 'Rayilin meethu Ruby' Hope my fellow Tamil Ruby enthusiasts may like it. On 1 December 2010 11:36, Edmond Kachale wrote: > RoRers, > > I am often interested with technologies that interface with natural > languages. These include machine translation systems, automatic (POS) > taggers and speech recognition systems, to mention a few. Above all, I am a > hardcore preacher of localization of software. > > I am curious about the *literal translation* of the phrase "Ruby on > Rails". > > Q: What is "*Ruby on Rails*" in your Language? > A: In my language, *Chichewa*, (a language in Malawi. ISO codes ny, nya.), > "*Ruby on Rails*" is *"Njero pa Njanje"* (read as *Njéro pâ Njânjé*). > > This question has been influenced by some the code snippets I have been > seeing on this forum. They contain non-English words. They excite and > energize me very much. > > Of course, "Ruby on Rails" is a proper noun which is often not literally > translated in localizations, but I am just curious about it. > > More blessing, > > --- > Edmond > Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) | > Malawi > > Cell: +265 999 465 137 | +265 881 234 717 > > *"Leading the Improvement of Health through Information and Communication > Technology in the Developing World" The **Creed* of *Baobab Health > * > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- -- Nandri(Thanks in Tamil), Amala Singh -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Develop Facebook app using rail
facebooker On Wed, Dec 1, 2010 at 5:01 PM, ashu wrote: > hello > > please tell me the way to develop facebook app by rails need to which > is good tool available now > > facebooker , rfacebook ,mini_fb > > and how to do post on users wall, email user , or send message to > user > > Any link , notes , tutorials , blog > > 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-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] What is "Ruby on Rails" in your Language?
RoRers, I am often interested with technologies that interface with natural languages. These include machine translation systems, automatic (POS) taggers and speech recognition systems, to mention a few. Above all, I am a hardcore preacher of localization of software. I am curious about the *literal translation* of the phrase "Ruby on Rails". Q: What is "*Ruby on Rails*" in your Language? A: In my language, *Chichewa*, (a language in Malawi. ISO codes ny, nya.), " *Ruby on Rails*" is *"Njero pa Njanje"* (read as *Njéro pâ Njânjé*). This question has been influenced by some the code snippets I have been seeing on this forum. They contain non-English words. They excite and energize me very much. Of course, "Ruby on Rails" is a proper noun which is often not literally translated in localizations, but I am just curious about it. More blessing, --- Edmond Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) | Malawi Cell: +265 999 465 137 | +265 881 234 717 *"Leading the Improvement of Health through Information and Communication Technology in the Developing World" The **Creed* of *Baobab Health * -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Develop Facebook app using rail
hello please tell me the way to develop facebook app by rails need to which is good tool available now facebooker , rfacebook ,mini_fb and how to do post on users wall, email user , or send message to user Any link , notes , tutorials , blog 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Update div with Prototype
Hello Guest, This is my full code, I want to update "datos", without the :remote => true the div is updated but the full page, and it does nothing. application.html.erb <%= title %> <%= csrf_meta_tag %> <%= render 'layouts/stylesheets' %> <%= javascript_include_tag :defaults %> <%= render 'layouts/header' %> <%= yield %> <%= render 'layouts/footer' %> _header.html.erb div class="menu_activado"> <% = link_to "Link", about_path,: remote => true%> routes.rb SampleApp::Application.routes.draw do match '/about', :to => 'pages#about' root :to => 'pages#home' end application_controller.rb class ApplicationController < ActionController::Base protect_from_forgery include SessionsHelper end pages_controller.rb class PagesController < ApplicationController def home @title = "Home" end def about @title = "About" end end application_helper.rb module ApplicationHelper base_title = "Example" if @title.nil? base_title else "#{base_title} | #...@title}" end end end Thank you. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: template not rendering (unable to retrieve data)
On 1 December 2010 10:09, kiran wrote: > yes colin u r right...thank u...i am surprized to see it worked...a > simple slash made all the difference how would u figure out > this...anyway thanx.. I guess that it took the whole of the rest as the title, since the title had not been closed. You would have seen the problem if you had copied the complete html of the page (View, Page Source or similar in the browser) and pasted it into the w3c htlm validator website. It would have told you about the error. A good tip when something apparently very strange like this is happening is to look at the html source, you would then have seen that there was something there that should have been displayed but was not, this would have told you that it must be an error in the html rather than any subtle rails issue. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: template not rendering (unable to retrieve data)
yes colin u r right...thank u...i am surprized to see it worked...a simple slash made all the difference how would u figure out this...anyway thanx.. On Dec 1, 2:43 pm, Colin Law wrote: > On 1 December 2010 07:32, kiran wrote: > > > > > > > > > > > Controller:ads_controller.rb > > > class AdsController < ApplicationController > > > def index > > @ads = Ad.find(:all) > > end > > > def show > > @ad=Ad.find(params[:id]) > > (params[:id]) > > end > > > end > > > routeing: route.rb > > > ActionController::Routing::Routes.draw do |map| > > map.connect '/ads/', :controller=>'ads', :action=>'index' > > map.connect '/ads/:id', :controller=>'ads', :action=>'show' > > end > > > action;index.html.erb > > > > > > All Ads!! > > That should be at the end > > Colin > > > > > > > > > > > > > All Ads! > > > > <% for ad in @ads %> > > <%=ad.name %> > > <% end %> > > > > > > > > > any one know mebay application on head first rails...i am practicing > > that one. > > this application is all about displaying the list of adds to the > > users. > > see the above code to display the available ads on an index page .. > > but the list of names of ads not displaying when i run this > > application > > at "http://localhost:3000/ads"; whats wrong ...can anybody help me > > pls... > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-t...@googlegroups.com. > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Rails 3 and respond_to_parents
Use github.com/itkin/respond_to_parent -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Rails server does not take in account the production and still used development db
Gregory Grimaux wrote in post #965329: > Gregory Grimaux wrote in post #965320: >> Vladimir Rybas wrote in post #965318: I'm sorry I don't understand what you mean by *nix maybe you're talking about nginx >>> >>> He is talking about UNIX dude >> >> OK :D Sorry. I found my error. I had two site configured in my apache >> configuration. One with rails= prod and one with rails = dev. And of >> course it was using rails = dev. So I think I found my problem. I will >> let a message to confirm. I need to made some fix on server now since it >> does not start correctly. > > > > Now I have a another problem. It works in my development environment but > no in production. > > *** Exception ArgumentError in > PhusionPassenger::Railz::ApplicationSpawner (No association found for > name `machines'. Has it been defined yet?) (process 16052): > from > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:245:in > `accepts_nested_attributes_for' > from > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in > `each' > from > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in > `accepts_nested_attributes_for' > from /home/et1/wip3/sophia/app/models/machines_operatingsystem.rb:2 > > > But I don't understand why. Error found my fault. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Install Requirements for Independent Development
Do you have internet connectivity on all your workplaces? Why not setup all the dev stuff on a remote server and vnc to it from all your workplaces? Martin On Nov 30, 11:13 pm, Marnen Laibow-Koser wrote: > Peter Macgown wrote in post #965230: > > > > > > > > > > > Marnen Laibow-Koser wrote in post #965219: > >> Peter Macgown wrote in post #965218: > >>> Hi Marnen, > > >>> I have three different PC's running Windows (2 XP's and 1 Vista) at > >>> disparate locations. > > >> Those should be binary-compatible, then. (Why you'd torture yourself > >> with Windows is another question. :) ). > > >> Unix is moot since it is not available to me. > > >> Of course it's available to you: you can always install a VM. > > > Unfortunately, this would complicate matters for me. Not only would I be > > trying to teach myself Ruby, I would be futzing with a VM configuration > > and I wouldn't know what was wrong if it didn't work. > > VMs are generally easy to set up. Try it! > > "I wouldn't know what to do" is seldom a good reason not to try > something. Most of the time (as here), things are a lot easier than we > fear. > > [...] > > > I want to carry a flash drive so I can do development in different > > places without having to install Ruby on each of them. > > And you need all your dev libraries, and all your dev tools, and... > > [...] > > > It's sort of a fake project and I was looking for an excuse to do it. > > I've been playing with an Arduino board and thought that it would be > > interesting if I could use Ruby to collect the data rather than C++, C#, > > or another .net thing I have hanging around. > > Not a bad idea; for one thing, Ruby frees you from being tied to > Windows... > > > > > Using a flash drive solves one of the problems. I have an hour to spare > > here and there at different locations and wanted to take advantage of > > them without having to set up a development environment for each one of > > the computers. > > Why not use your own laptop? Even if you use a flash drive, you'll > probably have to set up a development environment to some extent. > > I really think that the best solution in this case is to run a VM off > the flash drive. > > > > >>> The Rails part intrigues me since it can be > >>> used for other languages besides Ruby. > > >> What? Rails is built in Ruby. There's no question of other languages. > >> Or do I misunderstand. > > > Nope. You get it. I show my ignorance here about Ruby and its > > relationship with Rails, or Rails in general for that matter. There is, > > however, a book out there that talks about developing Flash programs > > using Rails and I was making an oblique referenct to this. > > That's got nothing to do with the Ruby side of things. Rails is > server-side. Flash is client-side. (And please, *don't* use Flash > these days. HTML5 and JavaScript should get you where you need to go.) > > [...] > > > The point, I guess, is to answer the question, "can it be done?". If > > yes, that's great. If no, that's great too. If the answer is no, then > > the next step is to determine how to be as minimally invasive to the > > desktop as possible to make it work. > > Use a VM, preferably a *nix one (VirtualRails might be a good place to > start). Put that on the flash drive. Do all development within the VM. > Nothing has to be touched in the host environment. > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...@marnen.org > > -- > Posted viahttp://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: rvm and gem confusion
I recently had to reinstall rvm when I was upgrading from rails 3.0.0 to rails 3.0.3 (maybe too harsh but it worked), so in order to remove the cached gems (on a single user install), I removed all the stuff in $HOME/.rvm/gems Btw, I don't think you should've used sudo in the first place so maybe just doing a fresh single user install without sudo will help you. AFAIK, deleting .rvm is the recommended way on rvm's site to delete a single user install. Martin On Dec 1, 10:45 am, Paul Bergstrom wrote: > Chris Lemcke wrote in post #965274: > > > Did you install rvm using sudo? If you sudo install it, it'll make it > > so you have to use sudo to install any gems. If you want to tell which > > ruby you're running (on a mac) type: > > I can't remember but I don't think so. I stand as owner for the .rvm > directory. > > > which ruby > > > shouldn't be /usr/bin/ruby > > It's the ruby installed by rvm. > > Maybe I should start over. If I uninstall rvm will that mean I get rid > of the installed rvm gems as well? I presume so. Can I just delete the > .rvm directory? > > -- > Posted viahttp://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: incompatible character encodings: ASCII-8BIT and UTF-8
Robert K. wrote in post #965170: > > A monkey work-around > > A better work-around > Thanks! Perfect. I'm also waiting for a fix in 3.0.4. As you asked: Does anyone know if patch and Git exists in windows? If no; how to apply std nix patch files? About mysql og not. It's religion, you know :-) I've used Oracle on Unix/Linux through many years. I like mysql, though. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] template not rendering (unable to retrieve data)
On 1 December 2010 07:32, kiran wrote: > Controller:ads_controller.rb > > class AdsController < ApplicationController > > def index > @ads = Ad.find(:all) > end > > def show > @ad=Ad.find(params[:id]) > (params[:id]) > end > > end > > > routeing: route.rb > > ActionController::Routing::Routes.draw do |map| > map.connect '/ads/', :controller=>'ads', :action=>'index' > map.connect '/ads/:id', :controller=>'ads', :action=>'show' > end > > > action;index.html.erb > > > All Ads!! That should be at the end Colin > > > All Ads! > > <% for ad in @ads %> > <%=ad.name %> > <% end %> > > > > > > any one know mebay application on head first rails...i am practicing > that one. > this application is all about displaying the list of adds to the > users. > see the above code to display the available ads on an index page .. > but the list of names of ads not displaying when i run this > application > at "http://localhost:3000/ads"; whats wrong ...can anybody help me > pls... > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Rails server does not take in account the production and still used development db
Gregory Grimaux wrote in post #965320: > Vladimir Rybas wrote in post #965318: >>> I'm sorry I don't understand what you mean by *nix maybe you're talking >>> about nginx >> >> He is talking about UNIX dude > > OK :D Sorry. I found my error. I had two site configured in my apache > configuration. One with rails= prod and one with rails = dev. And of > course it was using rails = dev. So I think I found my problem. I will > let a message to confirm. I need to made some fix on server now since it > does not start correctly. Now I have a another problem. It works in my development environment but no in production. *** Exception ArgumentError in PhusionPassenger::Railz::ApplicationSpawner (No association found for name `machines'. Has it been defined yet?) (process 16052): from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:245:in `accepts_nested_attributes_for' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in `each' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/nested_attributes.rb:222:in `accepts_nested_attributes_for' from /home/et1/wip3/sophia/app/models/machines_operatingsystem.rb:2 But I don't understand why. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: rvm and gem confusion
Chris Lemcke wrote in post #965274: > Did you install rvm using sudo? If you sudo install it, it'll make it > so you have to use sudo to install any gems. If you want to tell which > ruby you're running (on a mac) type: I can't remember but I don't think so. I stand as owner for the .rvm directory. > which ruby > > shouldn't be /usr/bin/ruby It's the ruby installed by rvm. Maybe I should start over. If I uninstall rvm will that mean I get rid of the installed rvm gems as well? I presume so. Can I just delete the .rvm directory? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Rails 2.3.8 Action Caching without layout (ajax and non-ajax requests)
Okay, works fine now! I slightly changed the way I overwrote the ActionCacheFilter. On 30 Nov., 22:58, nico wrote: > Okay, I debugged a bit more and found out what the problem is > (at least when locally in development environment). Inside the action > cache content_for_layout > is called to get the content to be cached if layout is set to false. > This causes > my ajax requests to be not cached because content_for_layout returns > nil as > I don't render the layout with ajax calls, only a partial. So I do > need to set > layout to true for ajax calls. However I can't do that the way I tried > to, as > the layout param doesn't accept a Proc. So I overwrote part of the > ActionCacheFilter class > to test the layout for a call method and call it if present. That > works great locally! > However, in production on Heroku with Memcached it still won't work > properly. > Ajax calls are not cached. > > On 30 Nov., 16:30, nico wrote: > > > > > > > > > Hi there, > > > I'm using Action Caching with Rails 2.3.8 on Heroku with Memcached > > (via Dalli Gem). > > > Without the layout parameter Action Caching works fine. However, as > > soon as I add layout => false I get problems: Normal non-ajax requests > > are cached fine, without the layout, as expected. But ajax requests > > are not properly cached: I get cache misses all the time. Then, when I > > log in to my app neither normal, nor ajax requests are cached at all. > > > I also tried to set :layout => Proc.new { |c| c.request.xhr? } > > When I do that ajax and normal requests are properly cached (no matter > > if logged out or logged in) > > but normal requests also cache the layout. Seems odd to me as normal > > requests should have :layout => false. > > I'm trying to debug this for hours now, but I haven't got a clue > > what's going on so far. What especially confuses me > > is that the logged in state of my app apparently has an influence on > > the caching behaviour. > > > Here is my full caching call (for the case of layout => false): > > > [code]caches_action :index, :layout => false, > > :cache_path => Proc.new { |c| > > c.params.clone.delete_if { |k,v| ['authenticity_token'].include? > > (k) }.merge(:xhr => c.request.xhr? ? 't' : 'f') }[/code] > > > I'd greatly appreciate any help on this! > > > Nico -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Rails server does not take in account the production and still used development db
Vladimir Rybas wrote in post #965318: >> I'm sorry I don't understand what you mean by *nix maybe you're talking >> about nginx > > He is talking about UNIX dude OK :D Sorry. I found my error. I had two site configured in my apache configuration. One with rails= prod and one with rails = dev. And of course it was using rails = dev. So I think I found my problem. I will let a message to confirm. I need to made some fix on server now since it does not start correctly. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: how to 'delete' an object from an association collection in-memory only
Hi, I'm not sure why you are worried about touching the data store. collection.build doesn't save the new object so there is nothing in the db that could be deleted. If all you want to do is revert collection.build just remove that element of the association array (as pepe pointed out). comment = @post.comments.build @post.comments.delete(comment) or @post.comments.build @post.comments.delete(@post.comments.last) Hope this helps! Simon On Nov 30, 9:13 pm, Lille wrote: > Hi, > > My Rails app offers opportunities to try out models on a 'what-if' > basis, where dependent associations can be modified to obtain > alternative results for the parent. Is there a way to delete/destroy > the member of a collection so that I can play around with the > accordingly modified parent in memory, without actually committing the > destruction of the collection member to the data store? Based on my > read of the docs, there is no 'delete' counterpart to > 'collection.build' for association members. > > Thanks for any comment, > > Lille -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Rails server does not take in account the production and still used development db
> I'm sorry I don't understand what you mean by *nix maybe you're talking > about nginx He is talking about UNIX dude On Wed, Dec 1, 2010 at 10:38 AM, Gregory Grimaux wrote: > Marnen Laibow-Koser wrote in post #965154: >> Gregory Grimaux wrote in post #965148: >>> 0 down vote favorite >>> >>> >>> Hi, since several days I have this problem: >>> >>> For a few days it has worked and now I can't do it works again. I setup >>> a rails server on ubuntu with apache-2. I used a git repository to get >>> all new change. After I run >>> sudo rake db:migrate RAILS_ENV=production >> >> You shouldn't be using sudo for that. >> > OK I will not used sudo in future. >>> >>> But after have restart apache server I can see that rails use the >>> development db and not the production while before it has used it. >> >> Then you have not set your RAILS_ENV environment variable correctly. >> You can usually do that in the Apache config file. >> >> I assume you're using Passenger (and if not, you should). If I remember >> correctly, there is info in the Passenger docs on how to do this. >>> > > I'm using passenger with apache2. In my sites I set > RailsEnv production > > So I think it should be OK. > >>> MORE INFO: >>> While I'm trying to understand the problem I note something: When I >>> execute rake db:migrate RAILS_ENV=production I can see that it create me >>> the production db. >> >> Right, because RAILS_ENV=production puts you in the production >> environment -- for that task only. >> >>> But if I add new value in db I can see it still used >>> development. I'm continuing my search on google :D. But if someone knows >>> the answer >>> >>> I don't really understand what can cause this. So i really appreciate >>> some help. >> >> Simple: as I explained above, environment variables are not being set >> correctly. When you specify an environment variable on the command >> line, it is only used for that command. >> >> Please gain a better understanding of how environment variable work in >> *nix. > > I'm sorry I don't understand what you mean by *nix maybe you're talking > about nginx >> >> Best, >> -- >> Marnen Laibow-Koser >> http://www.marnen.org >> mar...@marnen.org > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.