Re: [Rails] Help me about Bcrypt-ruby
On Tue, Mar 19, 2013 at 1:37 AM, haxuan lac wrote: > I'm create a login form using Bcrypt-ruby but have error: > > uninitialized constant User::BCrypt What is User::BCrypt supposed to be? Where/how did you define it? (It appears you didn't, actually. Show some code so we have a half a chance of helping you.) > I had setup Bcrypt-ruby in Gemfile > > gem "bcrypt-ruby", :require => "bcrypt" > > and restart,rake db:migrate but not run.I had run bundle:install,bundle: > update and see Bcrypt had installed. > i'm afraid that i use gem 'rails', '3.2.1' in Gemfile > Could you help me solve this problem...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 unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Re: Change 'nil' using literal notation?
On Wed, Mar 20, 2013 at 8:11 PM, Dheeraj Kumar wrote: > Jordan Bedwell is correct. Ruby's constants are /meant/ to be not changed, > but you can define a constant and change its value later. Ruby will produce > a warning 'already initialized constant' > > Also note that your constant's internal representation can be changed > without triggering the warning. > > 1.9.3p374 :001 > Const = 'a' > => "a" > 1.9.3p374 :002 > Const = 'b' > (irb):2: warning: already initialized constant Const > => "b" > 1.9.3p374 :003 > Const = {a: 'a'} > (irb):3: warning: already initialized constant Const > => {:a=>"a"} > 1.9.3p374 :005 > Const[:a] = 'b' > => "b" The last is misleading. You have created a constant that points to an Hash object. However, the Hash object itself is not frozen. The values pointed to by the keys are not constant or frozen. You can add new keys to the Hash, change values, etc. But if you try to set Const to something else (any other object) it will again show the warning. irb(main):025:0> Const={a: 'a'} {:a=>"a"} irb(main):026:0> Const[:a] = 'b' "b" irb(main):027:0> Const={A: 'A', B: 'B'} (irb):27: warning: already initialized constant Const {:A=>"A", :B=>"B"} irb(main):029:0> Const[:z] = 'Z' "Z" irb(main):030:0> Const {:A=>"A", :B=>"B", :z=>"Z"} irb(main):031:0> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Method inside method in controller
On Tue, Mar 19, 2013 at 7:36 AM, Barry wrote: > I'm trying to follow DRY way of coding. I decided to make my code cleanes. > Basically, app has 2 types of what to show to user, depending on content. So > I want to set up inside show method conditional, and then two different > inner methods for conditional. And, of cource, two different views for this > methods. > For exapmle: > def show > If conditional > show_empty > else > show_with_content > end > def show_empty > #some code > end > def show_with_content > #some code > end > end > > And I want controller to request show_emty.html.erb and > show_with_content.html.erb, based on what inner method was called. > Because my view code became really dirty and overcomplicated. > But trying to do that, I faced several errors. (nil class, wrong route). > What should I set up in routes? And how explain to Rails that it should not > to seek show.html.erb, but view for inner methods? The concept is sound. However, with no details about what your code is actually doing, real error messages, and the like, it's very hard to offer any sort of help. Please read through the rails debugging guide[1] to see if that will help you. [1]: http://guides.rubyonrails.org/debugging_rails_applications.html -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Re: Rails 4.0 Example app
On Wed, Mar 20, 2013 at 6:35 AM, wrote: > Thank you for the suggestion, yes of course I would have given up years ago > without RBs fantastically clear material. > > However edit multiple does not work on multi-level nested attributes. Yet > edit a single multi-level nested attribute (using update_attributes) works > fine. > > My main point is that of newcomer accessibility. TDD may make a development > more agile but there is nothing better than an example app that exercises > all the simple/minimum/core functionality and use-cases. > > Just how long do you think it would take a true expert involved in edge > rails development to write a small app ? > > I suspect that it does'nt exist because it is too hard to do. > > Another point is that an example app is like a picture being worth a > thousand words. It proceeds the documentation lag and displays a best > practice approach that is clearly comprehensible by a much broader ability > level. > > I would gladly write one and give it back to the community if I could get it > all to work and if I was sure that my approach was in line with the current > version of rails best practice. > > An example app should execute without error and be a minimum requirement > before a new release is issued. This is another example where TDD has > pushed out verifying the basic use-case requirements. > > Sorry if this sounds like a rant but I am almost at the end of my tether > after giving up on rails 2.x, starting again on 3, and again on 3.2 and now > on 4.0.0.beta1. Rails is becoming so agile that you are lucky to complete > an application before the next version is released. > > Just one last time - can anyone knock out a simple app displaying core > use-cases I have highlighted ? > > > On Monday, 18 March 2013 19:32:57 UTC, jle...@socit.co.uk wrote: >> >> Hi All, >> I have 30 years as a self employed software engineer and have been >> experimenting with rails for several years but !! >> >> I would have made considerably more progress and been able to give back to >> the community if only there was a demo application that was released with >> each new rails release. >> >> I am sure that it would take no more than 15 minutes of someone within the >> core team to produce an app that provides just the basic of use cases: >> >> Edit of multi-level nested attributes in a single form. >> Edit several models on the same form. >> Edit multiple records from a single model on the same form. >> Basic authentication. >> Digest authentication. >> >> What do you think ? >> >> P.S. On ubuntu using rvm Ruby 2.0 and Rails 4.0.0.beta1 and Ruby Mine >> 5.0.2 the installation of each went without any problems. I just cannot >> find how to implement the simple examples listed above with Rails 4. >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/2MHp73ESuvAJ. > > For more options, visit https://groups.google.com/groups/opt_out. > > Sounds like it could be helpful. Go for it! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Change 'nil' using literal notation?
I didn't know that, 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Re: Change 'nil' using literal notation?
Jordan Bedwell is correct. Ruby's constants are /meant/ to be not changed, but you can define a constant and change its value later. Ruby will produce a warning 'already initialized constant' Also note that your constant's internal representation can be changed without triggering the warning. 1.9.3p374 :001 > Const = 'a' => "a" 1.9.3p374 :002 > Const = 'b' (irb):2: warning: already initialized constant Const => "b" 1.9.3p374 :003 > Const = {a: 'a'} (irb):3: warning: already initialized constant Const => {:a=>"a"} 1.9.3p374 :005 > Const[:a] = 'b' => "b" -- Dheeraj Kumar On Thursday 21 March 2013 at 6:33 AM, Jordon Bedwell wrote: > On Wed, Mar 20, 2013 at 7:53 PM, Dheeraj Kumar > mailto:a.dheeraj.ku...@gmail.com)> wrote: > > In ruby, any variable whose name starts with a capital letter becomes a > > constant. > > > > > Which implies there are actually constants in Ruby. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com > (mailto:rubyonrails-talk+unsubscr...@googlegroups.com). > To post to this group, send email to rubyonrails-talk@googlegroups.com > (mailto:rubyonrails-talk@googlegroups.com). > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Re: Change 'nil' using literal notation?
On Wed, Mar 20, 2013 at 7:53 PM, Dheeraj Kumar wrote: > In ruby, any variable whose name starts with a capital letter becomes a > constant. Which implies there are actually constants in Ruby. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Descent RoR shared hosting
Hi everyone. I was in the market for wordpress host today and i thought while i was at it why not get a hosting provider that can support RoR too. I just about to begin to try to learn rails & ruby. I'm a .net developer. It won't be any site with much load but of course id like to pick a hoster that kept ruby & rails somewhat current (without me having to do it manually) and i don't want to have to fight to deploy RoR projects. FYI I'll just be using cheap shared hosting and not a VPS. My site won't get enough traffic for the higher end hosting. I'm currently looking at Host Gator & BlueHost. Any recommendations would be apprciated. 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Re: Change 'nil' using literal notation?
In ruby, any variable whose name starts with a capital letter becomes a constant. -- Dheeraj Kumar On Thursday 21 March 2013 at 5:48 AM, Todd Hartsfield wrote: > umm as long as a variable does not have special characters or a space in > it, as far as I am aware I thought variables are case sensitive, but > should work. The example above I see a variable needs to be ALL_CAPS or > all_lowercase, you cannot HaVe_bOtH. Is that correct? > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com > (mailto:rubyonrails-talk+unsubscr...@googlegroups.com). > To post to this group, send email to rubyonrails-talk@googlegroups.com > (mailto:rubyonrails-talk@googlegroups.com). > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Change 'nil' using literal notation?
umm as long as a variable does not have special characters or a space in it, as far as I am aware I thought variables are case sensitive, but should work. The example above I see a variable needs to be ALL_CAPS or all_lowercase, you cannot HaVe_bOtH. Is that correct? -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Methods to access device IP inside a firewall through production ROR app
I have a ROR application that needs to access a device with it's own IP within my firewall. Within the network, the device IP is accessible through Ruby scripts utilizing TCP/IP protocol. I need a list of possible methods and implementations ( NOT PORT FORWARDING ) to spin a server behind this firewall to serve up data to the ROR application when it is on a production server. Anyone with any ideas please let me know. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/k8vjqmDcBYYJ. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Change 'nil' using literal notation?
Todd Hartsfield wrote in post #1102378: > Does anybody know can you change the output 'nil' to a different string > using literal notation? Besides constructor? > > Hash_Name = Hash.new("Anything other than nil!") > > Hash_name = { > "key" => "value" > }("Anything other than nil!") > > New at this, just wondering. Thanks in advance As an aside, you do realize that naming your variable "Hash_Name" makes it a constant right? Should be: hash_name = Hash.new("Anything other than nil!") If you really intended to make that new hash a constant then the convention is: HASH_NAME = Hash.new("Anything other than nil!") -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Change 'nil' using literal notation?
ahh the Conditional Assignment Operator, 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] using multiple joins in queries
I have this query: Report. joins(:alerts). joins(:alert_code). where(:unit_id => unit_id). where{time < my{self.time}}. where("alert_codes.name LIKE ?", "%Inside virtual fence%"). order("reports.time DESC").first Basically, it breaks: ActiveRecord::ConfigurationError (Association named 'alert_code' was not found; perhaps you misspelled it?): My associations look like this: report has_many alerts alert belongs_to :alert_code, :foreign_key => :code I am trying to get the first report whose alerts belongs to alert_code whose name is "inside virtual fence". So there are 3 associations here. Trying to establish the connection. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] What would be the best way to handle this situation?
On Mar 20, 2013, at 11:18 AM, Ben Densmore wrote: > Should I pull that before_save out and manually call the geolocation_address > in the controller then when I hit the rescue block pass a variable so I know > not to call it again when the user updates the form again, or does someone > have a better solution? If it were me, I might keep two "global" variables (*not* session variables, so stored in the db or in text files), for the timestamps of the last successful transaction with the API, and the last failed transaction with the API. Then you could look at those and decide whether or not to try using the API. You might also consider some AJAXy voodoo to use the API *before* submitting the whole form... -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] What would be the best way to handle this situation?
Hi All, I'm trying to work out an issue and a bit stuck on the best way to handle this, so I'm hoping someone can give me some ideas to try. I have a form that contains some info about a particular job. Part of this form has some address info that once saved we gather some Geo Location info so we can plot the distance. We had an issue where the Geo API was down and therefore we couldn't get the distance in miles from the base office to a customers location for plotting on a map. I was asked to raise an error and bring the user back to the form to manually add in the distance if the API is not responding correctly. Pretty straight forward. The issue I am having is that I have a before_save method in the Job Model that runs this geo location code. If the API is having issues I Raise an error and handle it in the controller So the Model has before_save :geolocation_address def geolocation_address geo = APICall errors.add(:base, "Geo Location Failed" ) if !geo.success raise "Error" if !geo.success end Then in my controllers update action I have @job = Job.find(params[:id]) if @job.update_attributes(params[:job]) flash[:notice] = "Successfully updated job." return if has_session_return_to? redirect_to @job.contact else render :action => 'edit' end rescue render :action => 'edit' This brings the user back to the form to manually edit which is what I want. But the problem is that I'm always going to go back into the rescue block as long as the Geo location fails. Should I pull that before_save out and manually call the geolocation_address in the controller then when I hit the rescue block pass a variable so I know not to call it again when the user updates the form again, or does someone have a better solution? Thanks, Ben -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/GP1gLRhHtZ4J. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] restful_json - implement declarative, featureful backend JSON services in Rails 3.1+, 4+ quickly
Looks pretty cool at first glance! I was thinking of abstracting something similar. I'll try this first, though, on my next new project. On Tue, Mar 19, 2013 at 2:37 PM, gsw wrote: > Hey, > > We've been using this for a while in production and just made some > security fixes today and added it to Rubygems: > > https://github.com/rubyservices/restful_json > > Just: > > gem 'restful_json' > > and follow the directions in the README (it GitHub link above). It should > work with Rails 3.1+ and 4+ (we use it in latest Rails 3.2.x currently). If > you're unfamiliar with the Rails 4 way of doing things (activemodel > serializers), there will be a slight learning curve, but it is really quick > to create new controllers. > > Let me know what you think, and submit pull req's/issues if you have any. > > Thanks! > > Gary > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/jLnlHre5eR4J. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Re: storing values in session variable vs instance variable
On Wed, Mar 20, 2013 at 10:48 AM, Colin Law wrote: > On 20 March 2013 15:41, John Merlino wrote: >> instance variables are alive as long as the object instance is alive. My >> question then would be from one http request to the next does the same >> controller instance remain alive? > > No. In addition, once you deploy, you cannot even assume that the > server is still running. Many systems will shut down the server if it > is idle and re-start it when required. Also remember that if user A > makes a request then is it common that user B may make a request > before the next request from user A. So even if the same controller > instance did stay alive the data for the two users would get mixed up. > Sessions get around this problem. Why hello admin account, how do I love getting it for free :D -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Re: storing values in session variable vs instance variable
On 20 March 2013 15:41, John Merlino wrote: > instance variables are alive as long as the object instance is alive. My > question then would be from one http request to the next does the same > controller instance remain alive? No. In addition, once you deploy, you cannot even assume that the server is still running. Many systems will shut down the server if it is idle and re-start it when required. Also remember that if user A makes a request then is it common that user B may make a request before the next request from user A. So even if the same controller instance did stay alive the data for the two users would get mixed up. Sessions get around this problem. Colin > If so, then there's no need for sessions > at all. Right? > > > On Tuesday, March 19, 2013 12:23:44 PM UTC-4, Ruby-Forum.com User wrote: >> >> Norm Scherer wrote in post #1102294: >> > On 03/18/2013 10:37 AM, John Merlino wrote: >> >> Is there a good practice when to use the session variable. Sometimes I >> >> find myself using both the session variable and instance variable. For >> >> example, I have a table that allows a user to select a date. I store >> >> the date both in the session and in the instance variable. Should I >> >> not bother to store it in session? In what situations should you use >> >> the session variable? -- >> > The rails session persists across requests while instance variables do >> > not. If you need something in a following request it (or a reference) >> > must be in the session. If you do not need it later I always use an >> > instance variable. >> >> I wouldn't say that this is precisely accurate. You could continue >> passing a variable from one request to another, and to third, and so on. >> >> Session variables are useful when you really need a value to persist for >> the entire session. I would also say that it's good practice to use >> session variable sparingly. Session variables are somewhat akin to >> global variables in the sense that they represent globally accessible >> shared state (at least within the context of the current session). >> >> Session variables are also long lived, taking up memory as long as the >> session is kept alive. Although in a Rails application sessions are torn >> down and recreate upon every request, but that might even be worse than >> just leaving them in memory between requests. >> >> Another thing to keep in mind is that by default Rails uses a cookie >> based session storage mechanism, which means sessions have a hard 4K >> limit (cookies are limited to 4K by spec). Another reason to avoid >> putting large amounts of data in the session. >> >> A typical use case for session variable are things like the "id" of the >> current user. Notice I said the "id" not the user object itself. It's >> better to load the user object when, and only when, necessary. There are >> other great uses for session variables, but think twice about if it's >> really necessary and try to keep the amount of data as small as >> possible. Remember for every variable in the session is just one more >> thing that has to be loaded from persistent storage on every single >> request. >> >> -- >> 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 unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/WjlpqhZwf88J. > > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: storing values in session variable vs instance variable
instance variables are alive as long as the object instance is alive. My question then would be from one http request to the next does the same controller instance remain alive? If so, then there's no need for sessions at all. Right? On Tuesday, March 19, 2013 12:23:44 PM UTC-4, Ruby-Forum.com User wrote: > > Norm Scherer wrote in post #1102294: > > On 03/18/2013 10:37 AM, John Merlino wrote: > >> Is there a good practice when to use the session variable. Sometimes I > >> find myself using both the session variable and instance variable. For > >> example, I have a table that allows a user to select a date. I store > >> the date both in the session and in the instance variable. Should I > >> not bother to store it in session? In what situations should you use > >> the session variable? -- > > The rails session persists across requests while instance variables do > > not. If you need something in a following request it (or a reference) > > must be in the session. If you do not need it later I always use an > > instance variable. > > I wouldn't say that this is precisely accurate. You could continue > passing a variable from one request to another, and to third, and so on. > > Session variables are useful when you really need a value to persist for > the entire session. I would also say that it's good practice to use > session variable sparingly. Session variables are somewhat akin to > global variables in the sense that they represent globally accessible > shared state (at least within the context of the current session). > > Session variables are also long lived, taking up memory as long as the > session is kept alive. Although in a Rails application sessions are torn > down and recreate upon every request, but that might even be worse than > just leaving them in memory between requests. > > Another thing to keep in mind is that by default Rails uses a cookie > based session storage mechanism, which means sessions have a hard 4K > limit (cookies are limited to 4K by spec). Another reason to avoid > putting large amounts of data in the session. > > A typical use case for session variable are things like the "id" of the > current user. Notice I said the "id" not the user object itself. It's > better to load the user object when, and only when, necessary. There are > other great uses for session variables, but think twice about if it's > really necessary and try to keep the amount of data as small as > possible. Remember for every variable in the session is just one more > thing that has to be loaded from persistent storage on every single > request. > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/WjlpqhZwf88J. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] CMS functions for a Rails web application
On Mar 20, 2013, at 6:16 AM, Anthony Candaele wrote: > Hi, > > I'm a newbie to Ruby on Rails, but I'm very attracted to this awesome web > technology. The only thing I'm wondering about, is how you can add CMS-like > functionality to your Rails website. > > Do you implement the CMS functions yourself, using Ruby Gems, or do you pick > a Rails CMS like Refenery CMS, Locomotive CMS etc ... > > I'm especially interested in a very lightweight CMS, and I'm wondering what's > the best strategy: > > just implement the CMS functions myself or use a Rails CMS solution like > Refinery CMS, Locomotive CMS, etc ... The honest answer is "it depends". Do you need the multi-user goodies of Refinery, providing you a full suite of editing and publishing controls? Do you need to manipulate a site "tree" and place content in a hierarchy? If your needs are simple, you might be best served by writing something yourself. It will be just enough to do what you need, and you'll know where the bodies are buried. But if an honest assessment of your needs turns up some of the things that an existing solution does well, you may as well just use it and learn what it can do. You may end up adding features -- for free -- that you didn't know you needed. Walter > > Thanks for your advice, > > Anthony > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/WdSWfgQOFKYJ. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
RE: [Rails] Using scaffolding
Restarting the server didn't fix the problem, I believe I was in the correct directory but that maybe was the problem. I've since closed the terminal down and it's now working. This is certainly the fastest setup I've ever experienced in getting a framework up and running. Hopefully today's progress will be good too! Cheers, G > From: clan...@googlemail.com > Date: Wed, 20 Mar 2013 13:29:01 + > Subject: Re: [Rails] Using scaffolding > To: rubyonrails-talk@googlegroups.com > > On 20 March 2013 10:34, G M wrote: > > I tried that a number of times but it didn't work, closing the terminal > > window was the only way to get it to work. > > What do you mean "it didn't work"? Do you mean that it did not stop > the server or it stopped the server but restarting it did not fix the > problem? If the latter were you in the correct directory in the > terminal? If the former what OS are you using? > > Colin > > > > > G :) > > > >> From: clan...@googlemail.com > >> Date: Wed, 20 Mar 2013 10:23:59 + > > > >> Subject: Re: [Rails] Using scaffolding > >> To: rubyonrails-talk@googlegroups.com > >> > >> On 20 March 2013 10:17, G M wrote: > >> > Hi Colin, > >> > > >> > Closing the terminal and restarting the server did the trick, thank you. > >> > >> You should be able to stop the server using Ctrl+C (on linux anyway). > >> Not sure about other systems. > >> > >> Colin > >> > >> > > >> > > >> > G :) > >> > > >> >> From: clan...@googlemail.com > >> >> Date: Wed, 20 Mar 2013 09:49:14 + > >> >> Subject: Re: [Rails] Using scaffolding > >> >> To: rubyonrails-talk@googlegroups.com > >> > > >> >> > >> >> On 20 March 2013 00:47, G wrote: > >> >> > Hi all, > >> >> > > >> >> > I've been following this online book: > >> >> > > >> >> > > >> >> > http://ruby.railstutorial.org/chapters/a-demo-app#sec-modeling_demo_users > >> >> > > >> >> > I ran the commands: > >> >> > rails generate scaffold User name:string email:string > >> >> > bundle exec rake db:migrate > >> >> > > >> >> > As I understand it I should be able to go to the following URL and it > >> >> > should > >> >> > display a list of users: > >> >> > http://localhost:3000/users > >> >> > > >> >> > > >> >> > However I get this error: > >> >> > > >> >> > "Routing Error > >> >> > > >> >> > No route matches [GET] "/users" > >> >> > > >> >> > Try running rake routes for more information on available routes." > >> >> > >> >> Have you restarted the server since you made the change? It is not > >> >> necessary to restart when changing model/view/controller files but if > >> >> any configuration files (such as routes.rb) are changed then it is > >> >> necessary to restart it. > >> >> > >> >> Othewise, did you try running rake routes to show you the routes > >> >> available, as suggested? You may not yet be able to fully understand > >> >> the output but it is worth following the suggestion anyway. > >> >> Have a look at config/routes.rb. I would have expected the generate > >> >> scaffold command to have added something like > >> >> > >> >> resources :users > >> >> > >> >> to it. > >> >> > >> >> > > >> >> > > >> >> > In the first chapter another application was created, could it be > >> >> > that > >> >> > the > >> >> > rails server is serving the first application instead of the one from > >> >> > the > >> >> > second chapter of the book? > >> >> > >> >> Assuming that you are running the commands from within the folder of > >> >> the second application then no. I presume you have run rails server > >> >> from within the second application. > >> >> > >> >> Colin > >> >> > >> >> -- > >> >> You received this message because you are subscribed to the Google > >> >> Groups > >> >> "Ruby on Rails: Talk" group. > >> >> To unsubscribe from this group and stop receiving emails from it, send > >> >> an > >> >> email to rubyonrails-talk+unsubscr...@googlegroups.com. > >> >> To post to this group, send email to rubyonrails-talk@googlegroups.com. > >> >> For more options, visit https://groups.google.com/groups/opt_out. > >> >> > >> >> > >> > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "Ruby on Rails: Talk" group. > >> > To unsubscribe from this group and stop receiving emails from it, send > >> > an > >> > email to rubyonrails-talk+unsubscr...@googlegroups.com. > >> > To post to this group, send email to rubyonrails-talk@googlegroups.com. > >> > For more options, visit https://groups.google.com/groups/opt_out. > >> > > >> > > >> > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Ruby on Rails: Talk" group. > >> To unsubscribe from this group and stop receiving emails from it, send an > >> email to rubyonrails-talk+unsubscr...@googlegroups.com. > >> To post to this group, send email to rubyonrails-talk@googlegroups.com. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > -- > > You received this message because you are subscribed to
Re: [Rails] Using scaffolding
On 20 March 2013 10:34, G M wrote: > I tried that a number of times but it didn't work, closing the terminal > window was the only way to get it to work. What do you mean "it didn't work"? Do you mean that it did not stop the server or it stopped the server but restarting it did not fix the problem? If the latter were you in the correct directory in the terminal? If the former what OS are you using? Colin > > G :) > >> From: clan...@googlemail.com >> Date: Wed, 20 Mar 2013 10:23:59 + > >> Subject: Re: [Rails] Using scaffolding >> To: rubyonrails-talk@googlegroups.com >> >> On 20 March 2013 10:17, G M wrote: >> > Hi Colin, >> > >> > Closing the terminal and restarting the server did the trick, thank you. >> >> You should be able to stop the server using Ctrl+C (on linux anyway). >> Not sure about other systems. >> >> Colin >> >> > >> > >> > G :) >> > >> >> From: clan...@googlemail.com >> >> Date: Wed, 20 Mar 2013 09:49:14 + >> >> Subject: Re: [Rails] Using scaffolding >> >> To: rubyonrails-talk@googlegroups.com >> > >> >> >> >> On 20 March 2013 00:47, G wrote: >> >> > Hi all, >> >> > >> >> > I've been following this online book: >> >> > >> >> > >> >> > http://ruby.railstutorial.org/chapters/a-demo-app#sec-modeling_demo_users >> >> > >> >> > I ran the commands: >> >> > rails generate scaffold User name:string email:string >> >> > bundle exec rake db:migrate >> >> > >> >> > As I understand it I should be able to go to the following URL and it >> >> > should >> >> > display a list of users: >> >> > http://localhost:3000/users >> >> > >> >> > >> >> > However I get this error: >> >> > >> >> > "Routing Error >> >> > >> >> > No route matches [GET] "/users" >> >> > >> >> > Try running rake routes for more information on available routes." >> >> >> >> Have you restarted the server since you made the change? It is not >> >> necessary to restart when changing model/view/controller files but if >> >> any configuration files (such as routes.rb) are changed then it is >> >> necessary to restart it. >> >> >> >> Othewise, did you try running rake routes to show you the routes >> >> available, as suggested? You may not yet be able to fully understand >> >> the output but it is worth following the suggestion anyway. >> >> Have a look at config/routes.rb. I would have expected the generate >> >> scaffold command to have added something like >> >> >> >> resources :users >> >> >> >> to it. >> >> >> >> > >> >> > >> >> > In the first chapter another application was created, could it be >> >> > that >> >> > the >> >> > rails server is serving the first application instead of the one from >> >> > the >> >> > second chapter of the book? >> >> >> >> Assuming that you are running the commands from within the folder of >> >> the second application then no. I presume you have run rails server >> >> from within the second application. >> >> >> >> Colin >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> >> Groups >> >> "Ruby on Rails: Talk" group. >> >> To unsubscribe from this group and stop receiving emails from it, send >> >> an >> >> email to rubyonrails-talk+unsubscr...@googlegroups.com. >> >> To post to this group, send email to rubyonrails-talk@googlegroups.com. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "Ruby on Rails: Talk" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to rubyonrails-talk+unsubscr...@googlegroups.com. >> > To post to this group, send email to rubyonrails-talk@googlegroups.com. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-talk+unsubscr...@googlegroups.com. >> To post to this group, send email to rubyonrails-talk@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Multiple image upload
Upload is fine. Suppose I am uploading five images, which I can do with file upload. But I also need to upload those images to a specific category. I also need to save Image name and which category(dropdown) it belongs into the db. Suppose I uploaded 2 images:- After clicking on submit, I will get :- Image , Image Name : Text(We have to input), Category : Dropdown It will repeat On Wed, Mar 20, 2013 at 2:32 PM, Colin Law wrote: > On 20 March 2013 05:08, Avi wrote: > > Hello All, > > > > I have a requirement. > > I am uploading multiple images from a folder. > > After Submit, it should show all the images row-wise in the UI in the > same > > page as :- > > Image Name : name.png > > Image Name : hello.png etc. > > Which bit don't you know how to do? Upload? Redirect to the correct > view after upload? Fetch names from db in controller action? View > the names? > > We are not telepathic, you must ask specific questions not just ask us > how to write your application. > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Thanks & Regards, *Avinash Behera* *M-09538712979* -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Learning Rails - Advice for development environment
Hi Michael, I think the problem may be with the hardware being too new. Some lap tops have good comparability with mainstream linux distros. I had better success with older hardware and although they run slow under windows (which is by design by M$) they run quite fast under linux. For example Lubuntu 12.04 installs without problem on a Lenovo 3000 N100. With rvm and RubyMine I can run multiple versions of ruby and rails. On Monday, 18 March 2013 19:46:31 UTC, Michael Armistead wrote: > > Hello, > > I have been learning Rails for several weeks now. I am working through > Michael Hartl's tutorial and other various things. My question is basically > regarding what type of environment to do my development in. First, some > background: > > I have used different linux distros on and off throughout the years, so it > was easy and familiar for me to set up my desktop computer with Mint and > get rvm/rails etc installed and working correctly. No issues there. > > However, I went out and bought a laptop this last weekend; I have never > installed any linux variant on a laptop, so when I did it was startling to > find out how incredibly terrible the battery life / power management > functions were. I was getting ~2 hours of life just doing simple web > browsing. After spending an afternoon tweaking everything (using powertop, > thinkfan etc), I was able to increase that marginally. > > Then, I had someone recommend that I use win7 as my host OS, and then use > a VM for rails development. While doing some research, I came across > Vagrant. I got it set up and installed using one of the boxes made for > rails development, however I have not started using it yet. I guess the > idea is still quite fresh regarding workflow. If I was using a standard VM > with ubuntu or whatever, I would boot it up and do my work inside just as > if it was the host OS. When it comes to Vagrant, I am a little more > confused. > > Am I supposed to start my headless vagrant box, start all my services / > rails server etc inside, but then have Sublime Text 2 on my host OS - and > work out of the shared directory while just performing tests inside of the > VM? > > I use Guard / Spork on my desktop - how do I set this up within Vagrant? I > have read that some people have issues with it. > > Am I going to run into any problems down the line running windows as my OS > for coding / the VM for testing and server? > > Well, I am rambling. This whole idea is just very fresh for me, so I am > just looking for any feedback possible. I want to get my development > environment set up as fast (but as stable) as possible, so I can get back > to learning more rails! > > Thanks everyone, > Michael > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/g8HvTJDC2SEJ. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] CMS functions for a Rails web application
Hi, I'm a newbie to Ruby on Rails, but I'm very attracted to this awesome web technology. The only thing I'm wondering about, is how you can add CMS-like functionality to your Rails website. Do you implement the CMS functions yourself, using Ruby Gems, or do you pick a Rails CMS like Refenery CMS, Locomotive CMS etc ... I'm especially interested in a very lightweight CMS, and I'm wondering what's the best strategy: just implement the CMS functions myself or use a Rails CMS solution like Refinery CMS, Locomotive CMS, etc ... Thanks for your advice, Anthony -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/WdSWfgQOFKYJ. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Learning Rails - Advice for development environment
Hi Michael, I'm kind of in the same situation as Fai. I'm a .NET developer doing ASP.NET. But currently I started doing RoR development. For that purpose I bought a Mac. I understood that lot's of RoR use Textmate ( http://macromates.com/ ) as IDE. Texmate is only available for Mac. Another great editor is SublimeText 2 ( http://www.sublimetext.com/2 ). SublimeText2 is available for Mac and PC. I also heard a lot of praise about RubyMine by JetBrains ( http://www.jetbrains.com/ruby/) But the thing I like about RoR is just that it's less tool dependent like .NET development which relies heavily on Visual Studio and Sql Server. One can develop a Rails app by just using the terminal and an editor. hope this helps, Anthony Op maandag 18 maart 2013 20:46:31 UTC+1 schreef Michael Armistead het volgende: > > Hello, > > I have been learning Rails for several weeks now. I am working through > Michael Hartl's tutorial and other various things. My question is basically > regarding what type of environment to do my development in. First, some > background: > > I have used different linux distros on and off throughout the years, so it > was easy and familiar for me to set up my desktop computer with Mint and > get rvm/rails etc installed and working correctly. No issues there. > > However, I went out and bought a laptop this last weekend; I have never > installed any linux variant on a laptop, so when I did it was startling to > find out how incredibly terrible the battery life / power management > functions were. I was getting ~2 hours of life just doing simple web > browsing. After spending an afternoon tweaking everything (using powertop, > thinkfan etc), I was able to increase that marginally. > > Then, I had someone recommend that I use win7 as my host OS, and then use > a VM for rails development. While doing some research, I came across > Vagrant. I got it set up and installed using one of the boxes made for > rails development, however I have not started using it yet. I guess the > idea is still quite fresh regarding workflow. If I was using a standard VM > with ubuntu or whatever, I would boot it up and do my work inside just as > if it was the host OS. When it comes to Vagrant, I am a little more > confused. > > Am I supposed to start my headless vagrant box, start all my services / > rails server etc inside, but then have Sublime Text 2 on my host OS - and > work out of the shared directory while just performing tests inside of the > VM? > > I use Guard / Spork on my desktop - how do I set this up within Vagrant? I > have read that some people have issues with it. > > Am I going to run into any problems down the line running windows as my OS > for coding / the VM for testing and server? > > Well, I am rambling. This whole idea is just very fresh for me, so I am > just looking for any feedback possible. I want to get my development > environment set up as fast (but as stable) as possible, so I can get back > to learning more rails! > > Thanks everyone, > Michael > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/1Lxgoe1wWYIJ. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Rails 4.0 Example app
Thank you for the suggestion, yes of course I would have given up years ago without RBs fantastically clear material. However edit multiple does not work on multi-level nested attributes. Yet edit a single multi-level nested attribute (using update_attributes) works fine. My main point is that of newcomer accessibility. TDD may make a development more agile but there is nothing better than an example app that exercises all the simple/minimum/core functionality and use-cases. Just how long do you think it would take a true expert involved in edge rails development to write a small app ? I suspect that it does'nt exist because it is too hard to do. Another point is that an example app is like a picture being worth a thousand words. It proceeds the documentation lag and displays a best practice approach that is clearly comprehensible by a much broader ability level. I would gladly write one and give it back to the community if I could get it all to work and if I was sure that my approach was in line with the current version of rails best practice. An example app should execute without error and be a minimum requirement before a new release is issued. This is another example where TDD has pushed out verifying the basic use-case requirements. Sorry if this sounds like a rant but I am almost at the end of my tether after giving up on rails 2.x, starting again on 3, and again on 3.2 and now on 4.0.0.beta1. Rails is becoming so agile that you are lucky to complete an application before the next version is released. Just one last time - can anyone knock out a simple app displaying core use-cases I have highlighted ? On Monday, 18 March 2013 19:32:57 UTC, jle...@socit.co.uk wrote: > > Hi All, > I have 30 years as a self employed software engineer and have been > experimenting with rails for several years but !! > > I would have made considerably more progress and been able to give back to > the community if only there was a demo application that was released with > each new rails release. > > I am sure that it would take no more than 15 minutes of someone within the > core team to produce an app that provides just the basic of use cases: > > >1. Edit of multi-level nested attributes in a single form. >2. Edit several models on the same form. >3. Edit multiple records from a single model on the same form. >4. Basic authentication. >5. Digest authentication. > > What do *you* think ? > > P.S. On ubuntu using rvm Ruby 2.0 and Rails 4.0.0.beta1 and Ruby Mine > 5.0.2 the installation of each went without any problems. I just cannot > find how to implement the simple examples listed above with Rails 4. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/2MHp73ESuvAJ. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Learning Rails - Advice for development environment
I am using a Mac so I do not have you problems. Is you laptop certified for a specific distro of Linux. Do you know that Dell and may be HP have laptops certified for Ubuntu and Redhat? I personally would try to use Linux, bash, git, apt-get, more performance. I would try to fix Linux issues. You could develop in Windows, Ruby works on it. Vagrant is good, you can just run 'ssh vagrant' and call tests and guard from you windows shell. The problem is that Windows shell is rubbish and you have to use putty because Windows does not have ssh. I would just avoid to use Windows entirely, it is too limiting. I would try to fix LInux issues on the laptop or buy another laptop, seriously. On Monday, 18 March 2013 19:46:31 UTC, Michael Armistead wrote: > > Hello, > > I have been learning Rails for several weeks now. I am working through > Michael Hartl's tutorial and other various things. My question is basically > regarding what type of environment to do my development in. First, some > background: > > I have used different linux distros on and off throughout the years, so it > was easy and familiar for me to set up my desktop computer with Mint and > get rvm/rails etc installed and working correctly. No issues there. > > However, I went out and bought a laptop this last weekend; I have never > installed any linux variant on a laptop, so when I did it was startling to > find out how incredibly terrible the battery life / power management > functions were. I was getting ~2 hours of life just doing simple web > browsing. After spending an afternoon tweaking everything (using powertop, > thinkfan etc), I was able to increase that marginally. > > Then, I had someone recommend that I use win7 as my host OS, and then use > a VM for rails development. While doing some research, I came across > Vagrant. I got it set up and installed using one of the boxes made for > rails development, however I have not started using it yet. I guess the > idea is still quite fresh regarding workflow. If I was using a standard VM > with ubuntu or whatever, I would boot it up and do my work inside just as > if it was the host OS. When it comes to Vagrant, I am a little more > confused. > > Am I supposed to start my headless vagrant box, start all my services / > rails server etc inside, but then have Sublime Text 2 on my host OS - and > work out of the shared directory while just performing tests inside of the > VM? > > I use Guard / Spork on my desktop - how do I set this up within Vagrant? I > have read that some people have issues with it. > > Am I going to run into any problems down the line running windows as my OS > for coding / the VM for testing and server? > > Well, I am rambling. This whole idea is just very fresh for me, so I am > just looking for any feedback possible. I want to get my development > environment set up as fast (but as stable) as possible, so I can get back > to learning more rails! > > Thanks everyone, > Michael > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/sV9r7CExavYJ. For more options, visit https://groups.google.com/groups/opt_out.
RE: [Rails] Using scaffolding
I tried that a number of times but it didn't work, closing the terminal window was the only way to get it to work. G :) > From: clan...@googlemail.com > Date: Wed, 20 Mar 2013 10:23:59 + > Subject: Re: [Rails] Using scaffolding > To: rubyonrails-talk@googlegroups.com > > On 20 March 2013 10:17, G M wrote: > > Hi Colin, > > > > Closing the terminal and restarting the server did the trick, thank you. > > You should be able to stop the server using Ctrl+C (on linux anyway). > Not sure about other systems. > > Colin > > > > > > > G :) > > > >> From: clan...@googlemail.com > >> Date: Wed, 20 Mar 2013 09:49:14 + > >> Subject: Re: [Rails] Using scaffolding > >> To: rubyonrails-talk@googlegroups.com > > > >> > >> On 20 March 2013 00:47, G wrote: > >> > Hi all, > >> > > >> > I've been following this online book: > >> > > >> > http://ruby.railstutorial.org/chapters/a-demo-app#sec-modeling_demo_users > >> > > >> > I ran the commands: > >> > rails generate scaffold User name:string email:string > >> > bundle exec rake db:migrate > >> > > >> > As I understand it I should be able to go to the following URL and it > >> > should > >> > display a list of users: > >> > http://localhost:3000/users > >> > > >> > > >> > However I get this error: > >> > > >> > "Routing Error > >> > > >> > No route matches [GET] "/users" > >> > > >> > Try running rake routes for more information on available routes." > >> > >> Have you restarted the server since you made the change? It is not > >> necessary to restart when changing model/view/controller files but if > >> any configuration files (such as routes.rb) are changed then it is > >> necessary to restart it. > >> > >> Othewise, did you try running rake routes to show you the routes > >> available, as suggested? You may not yet be able to fully understand > >> the output but it is worth following the suggestion anyway. > >> Have a look at config/routes.rb. I would have expected the generate > >> scaffold command to have added something like > >> > >> resources :users > >> > >> to it. > >> > >> > > >> > > >> > In the first chapter another application was created, could it be that > >> > the > >> > rails server is serving the first application instead of the one from > >> > the > >> > second chapter of the book? > >> > >> Assuming that you are running the commands from within the folder of > >> the second application then no. I presume you have run rails server > >> from within the second application. > >> > >> Colin > >> > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Ruby on Rails: Talk" group. > >> To unsubscribe from this group and stop receiving emails from it, send an > >> email to rubyonrails-talk+unsubscr...@googlegroups.com. > >> To post to this group, send email to rubyonrails-talk@googlegroups.com. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to rubyonrails-talk+unsubscr...@googlegroups.com. > > To post to this group, send email to rubyonrails-talk@googlegroups.com. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Change 'nil' using literal notation?
||= X will set value if it's nil to X. 2013/3/20 Todd Hartsfield > Does anybody know can you change the output 'nil' to a different string > using literal notation? Besides constructor? > > Hash_Name = Hash.new("Anything other than nil!") > > Hash_name = { > "key" => "value" > }("Anything other than nil!") > > New at this, just wondering. Thanks in advance > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Using scaffolding
On 20 March 2013 10:17, G M wrote: > Hi Colin, > > Closing the terminal and restarting the server did the trick, thank you. You should be able to stop the server using Ctrl+C (on linux anyway). Not sure about other systems. Colin > > > G :) > >> From: clan...@googlemail.com >> Date: Wed, 20 Mar 2013 09:49:14 + >> Subject: Re: [Rails] Using scaffolding >> To: rubyonrails-talk@googlegroups.com > >> >> On 20 March 2013 00:47, G wrote: >> > Hi all, >> > >> > I've been following this online book: >> > >> > http://ruby.railstutorial.org/chapters/a-demo-app#sec-modeling_demo_users >> > >> > I ran the commands: >> > rails generate scaffold User name:string email:string >> > bundle exec rake db:migrate >> > >> > As I understand it I should be able to go to the following URL and it >> > should >> > display a list of users: >> > http://localhost:3000/users >> > >> > >> > However I get this error: >> > >> > "Routing Error >> > >> > No route matches [GET] "/users" >> > >> > Try running rake routes for more information on available routes." >> >> Have you restarted the server since you made the change? It is not >> necessary to restart when changing model/view/controller files but if >> any configuration files (such as routes.rb) are changed then it is >> necessary to restart it. >> >> Othewise, did you try running rake routes to show you the routes >> available, as suggested? You may not yet be able to fully understand >> the output but it is worth following the suggestion anyway. >> Have a look at config/routes.rb. I would have expected the generate >> scaffold command to have added something like >> >> resources :users >> >> to it. >> >> > >> > >> > In the first chapter another application was created, could it be that >> > the >> > rails server is serving the first application instead of the one from >> > the >> > second chapter of the book? >> >> Assuming that you are running the commands from within the folder of >> the second application then no. I presume you have run rails server >> from within the second application. >> >> Colin >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-talk+unsubscr...@googlegroups.com. >> To post to this group, send email to rubyonrails-talk@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
RE: [Rails] Using scaffolding
Hi Colin, Closing the terminal and restarting the server did the trick, thank you. G :) > From: clan...@googlemail.com > Date: Wed, 20 Mar 2013 09:49:14 + > Subject: Re: [Rails] Using scaffolding > To: rubyonrails-talk@googlegroups.com > > On 20 March 2013 00:47, G wrote: > > Hi all, > > > > I've been following this online book: > > http://ruby.railstutorial.org/chapters/a-demo-app#sec-modeling_demo_users > > > > I ran the commands: > > rails generate scaffold User name:string email:string > > bundle exec rake db:migrate > > > > As I understand it I should be able to go to the following URL and it should > > display a list of users: > > http://localhost:3000/users > > > > > > However I get this error: > > > > "Routing Error > > > > No route matches [GET] "/users" > > > > Try running rake routes for more information on available routes." > > Have you restarted the server since you made the change? It is not > necessary to restart when changing model/view/controller files but if > any configuration files (such as routes.rb) are changed then it is > necessary to restart it. > > Othewise, did you try running rake routes to show you the routes > available, as suggested? You may not yet be able to fully understand > the output but it is worth following the suggestion anyway. > Have a look at config/routes.rb. I would have expected the generate > scaffold command to have added something like > > resources :users > > to it. > > > > > > > In the first chapter another application was created, could it be that the > > rails server is serving the first application instead of the one from the > > second chapter of the book? > > Assuming that you are running the commands from within the folder of > the second application then no. I presume you have run rails server > from within the second application. > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Fwd: Problem With Unicorn
On Wed, Mar 20, 2013 at 5:10 AM, BalaRaju Vankala wrote: > I deployed my application in the local server and i'm using unicorn and > nginx. I tried to run 'bundle exec unicorn_rails' but it is showing" 'ERROR: > uninitialized constant Page::FriendlyId (NameError)" Because there is no constant named FriendlyId under Page, check your Page class and make sure you got FriendlyId right and if you are using friendly_id gem make sure it's required. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Fwd: Problem With Unicorn
Hello All, I deployed my application in the local server and i'm using unicorn and nginx. I tried to run 'bundle exec unicorn_rails' but it is showing" 'ERROR: uninitialized constant Page::FriendlyId (NameError)" -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Problem With Unicorn
Hello All, I deployed my application in the local server and i'm using unicorn and nginx. I tried to run 'bundle exec unicorn_rails' but it is showing 'ERROR: Gem bundler is not installed, run `gem install bundler` first.'. even if I run gem install bundler the bundler getting installed, But it is showing the same error again i.e. Gem bundler is not installed, run `gem install bundler`. Thanks in advance -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Using scaffolding
On 20 March 2013 00:47, G wrote: > Hi all, > > I've been following this online book: > http://ruby.railstutorial.org/chapters/a-demo-app#sec-modeling_demo_users > > I ran the commands: > rails generate scaffold User name:string email:string > bundle exec rake db:migrate > > As I understand it I should be able to go to the following URL and it should > display a list of users: > http://localhost:3000/users > > > However I get this error: > > "Routing Error > > No route matches [GET] "/users" > > Try running rake routes for more information on available routes." Have you restarted the server since you made the change? It is not necessary to restart when changing model/view/controller files but if any configuration files (such as routes.rb) are changed then it is necessary to restart it. Othewise, did you try running rake routes to show you the routes available, as suggested? You may not yet be able to fully understand the output but it is worth following the suggestion anyway. Have a look at config/routes.rb. I would have expected the generate scaffold command to have added something like resources :users to it. > > > In the first chapter another application was created, could it be that the > rails server is serving the first application instead of the one from the > second chapter of the book? Assuming that you are running the commands from within the folder of the second application then no. I presume you have run rails server from within the second application. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Using scaffolding
Hi all, I've been following this online book: http://ruby.railstutorial.org/chapters/a-demo-app#sec-modeling_demo_users I ran the commands: rails generate scaffold User name:string email:string bundle exec rake db:migrate As I understand it I should be able to go to the following URL and it should display a list of users: http://localhost:3000/users However I get this error: "Routing Error No route matches [GET] "/users" Try running rake routes for more information on available routes." In the first chapter another application was created, could it be that the rails server is serving the first application instead of the one from the second chapter of the book? Anyone any idea how to fix this issue? Thanks in advance. G -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/o_6BdY0oxgQJ. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] RoR on CentOS 5, file permissions
On Sunday, March 17, 2013 8:47:23 PM UTC+2, Frederick Cheung wrote: > > You should just be able to set this in the virtual host configuration. > > Now I found a way to do this. I could add PassengerDefaultUser apache # (or whichever user you like except root) to the virtual host block of the apache conf. I just tested this, and it works. But there is a more elegant way. All the necessary information is here: http://www.modrails.com/documentation/Users%20guide%20Apache.html#user_switching In essence, you just need to change the owner of config/environment.rb. This I did not test yet, though. - Jussi -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/b4M4h1BuTuwJ. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Multiple image upload
On 20 March 2013 05:08, Avi wrote: > Hello All, > > I have a requirement. > I am uploading multiple images from a folder. > After Submit, it should show all the images row-wise in the UI in the same > page as :- > Image Name : name.png > Image Name : hello.png etc. Which bit don't you know how to do? Upload? Redirect to the correct view after upload? Fetch names from db in controller action? View the names? We are not telepathic, you must ask specific questions not just ask us how to write your application. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.