|
Oh boy, I hadn't even thought about deployment until now. I have the base of this little tiny app done and, well, as the final step in learning Ruby I'm going to have to deploy it. I have never ever deployed a web app ever. The most advanced thing I've ever done is uploading PHP files as a straightshot and setting up sql databases for them - which is easy. The book I've got right now wants me to make an svn account and use capistrano and phusion but... I can't install phusion on my webhost so I'm assuming I can't do that (unless I'm missing how it works). All I can see that is rails related in my cpanel is the RoR thing that lets you make apps and a gem installer that wont let me install phusion. So... what is the easiest way for me to go about deploying this thing? (If it makes any difference I'm on a mac.)
|
# ? Mar 26, 2010 19:10 |
|
|
# ? Jun 4, 2024 12:19 |
|
Insurrectum posted:I'm new to web programming and have some general programming experience but I wouldn't say I'm extraordinarily adept. Mostly Numerical Recipes C++-type programming dealing with just numerical analysis. PHP might actually work for you for such a simple thing. It'd be far closer to C++ than you're used to, Ruby is more like Smalltalk+Perl and not really like anything else. Rails is good for build applications. If you want to use Ruby, I'd suggest Sinatra instead of Rails proper. For your graph, I'd suggest creating the data server-side, turning it into JSON (ActiveRecord makes this really easy with .to_json) and using flot client-side to turn it into a graph.
|
# ? Mar 26, 2010 19:17 |
|
The March Hare posted:Oh boy, I hadn't even thought about deployment until now. I have the base of this little tiny app done and, well, as the final step in learning Ruby I'm going to have to deploy it. I have never ever deployed a web app ever. The most advanced thing I've ever done is uploading PHP files as a straightshot and setting up sql databases for them - which is easy. The book I've got right now wants me to make an svn account and use capistrano and phusion but... I can't install phusion on my webhost so I'm assuming I can't do that (unless I'm missing how it works). All I can see that is rails related in my cpanel is the RoR thing that lets you make apps and a gem installer that wont let me install phusion. What's your webhost's Rails support? Many of them already use Passenger because it's easy to put into Apache like PHP is.
|
# ? Mar 26, 2010 19:20 |
|
The March Hare posted:So... what is the easiest way for me to go about deploying this thing? heroku, heroku, a million times heroku
|
# ? Mar 26, 2010 19:22 |
|
NotShadowStar posted:What's your webhost's Rails support? Many of them already use Passenger because it's easy to put into Apache like PHP is. I have no idea, I just know that passenger isn't listed in the ruby gems 'installed' list. How would I find out? e; For reference, I know that I have apache. I also know that, within cpanel X, I can see a ruby on rails button that lets me create a skeleton app and I also have a ruby on rails gem manager thing that doesn't actually let me install things (such as passenger) despite them being there with an install button. The March Hare fucked around with this message at 20:02 on Mar 26, 2010 |
# ? Mar 26, 2010 19:33 |
|
The March Hare posted:I have no idea, I just know that passenger isn't listed in the ruby gems 'installed' list. How would I find out? Does the skeleton app function when you create it? If so just do that and overwrite it in full with one your app. You will need to change your database.yml file to reflect your host's MySQL server settings, if you use MySQL. Once you do that, you should be able to do rake db:migrate RAILS_ENV=production and restart your server (somehow, probably within cpanel) and you're off. Or heroku.
|
# ? Mar 26, 2010 20:28 |
|
Trying this now, I have shell access too - I don't really know what my limits are but it seems to be letting me update things so that's good. OK I tried to rake but that didn't work, it gave me this error: (in /home/liarsbur/rails_apps/penny) rake aborted! undefined method `generate_best_match=' for ActionController::Routing:Module Then I noticed that mongrel wasn't running and I tried to start that but it gave me this error: e; "** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed." I tried commenting out RAILS_GEM_VERSION - didn't solve it. I updated the gem to the right version (I think) and it is still broken Any ideas ee; Just checked and my rubygems updater thing in cpanel agrees that I do, in fact, have "rails 2.3.5" The March Hare fucked around with this message at 21:25 on Mar 26, 2010 |
# ? Mar 26, 2010 20:48 |
|
Try 'rake rails:freeze:gems' which will put rails in your application instead of loading from system gems. One of the great things about the design of Rails is that you can be (almost) independent of the system. Rails 3 lets you be completely independent of the system (Don't use Rails 3 yet)
|
# ? Mar 26, 2010 21:46 |
|
Um that ran fine but I still can't do any of the other things... - same errors.
|
# ? Mar 26, 2010 21:58 |
|
Pardot posted:The server side option would be something built on rmajgick, but unless things have changed in the last year or so, everyone hates rmagick.
|
# ? Mar 26, 2010 22:28 |
|
Wait, you froze rails and it still tells you it can't find rails? I've never seen that...
|
# ? Mar 27, 2010 04:34 |
|
code:
|
# ? Mar 27, 2010 05:44 |
|
Aha, your host's Rails gem is 2.3.2 and you have a 2.3.5 app. I'd say freeze rails on your machine then transfer, then it should work fine. When you freeze it takes the currently installed system wide Rails and puts it in your application, which on your host is 2.3.2. Lots of shared hosting providers don't know how to manage Rails and yours falls into that category. 2.3.2 is ooooooooold. Therefore, heroku. (I've been using Dreamhost for Rails apps since 2006 and they've been totally fine).
|
# ? Mar 27, 2010 07:43 |
|
OK, I must be a complete retard or something because this poo poo is just not working in any way at all. So I guess I'll have to use heroku or just get a new webhost. Is shared webhosting always so lovely when it comes to rails? Would I be better off just getting some lovely unmanaged VPS and throwing apache sql and rails on that and going from there or what?
|
# ? Mar 27, 2010 20:27 |
|
The March Hare posted:Is shared webhosting always so lovely Yes. Rails and shared hosting is like trying to put a jet engine on your big wheels. Get a VPS (Linode) or use Heroku.
|
# ? Mar 27, 2010 20:38 |
|
Seriously just try heroku it's free until you need more power, at that point you can decide if you want to do take on the hassle of maintaining a server or just pay them. It's literally two commands to deploy a new app to heroku.
|
# ? Mar 27, 2010 20:40 |
|
Aight' I'll give heroku a go later. This is just all so very frustrating because I'm obviously capable of making this poo poo work locally but getting it deployed so I can do bug testing with friends is just not happening and I really want to learn this goddamn language/platform. Thanks for the help NotShadowStar &al
|
# ? Mar 27, 2010 20:44 |
|
The March Hare posted:Aight' I'll give heroku a go later. I started, finished, and deployed this app since my last post, it's that easy: http://justuse.heroku.com/The%20March%20Hare
|
# ? Mar 27, 2010 20:53 |
|
Pardot posted:I started, finished, and deployed this app since my last post, it's that easy: http://justuse.heroku.com/The%20March%20Hare love it
|
# ? Mar 27, 2010 21:08 |
|
Pardot posted:I started, finished, and deployed this app since my last post, it's that easy: http://justuse.heroku.com/The%20March%20Hare Hahaha point taken.
|
# ? Mar 27, 2010 21:54 |
|
Holy crap, how had I not heard of Heroku before? This looks amazing.
|
# ? Mar 27, 2010 23:53 |
|
Pardot posted:I started, finished, and deployed this app since my last post, it's that easy: http://justuse.heroku.com/The%20March%20Hare You should escape your inputs!! =)
|
# ? Mar 28, 2010 01:29 |
|
jonnii posted:You should escape your inputs!! =) ok done. I cheated a bit and used Sinatra code:
|
# ? Mar 28, 2010 05:54 |
|
I decided to use a unique name column to look up objects on one of my models. I want to be able to change this unique name.code:
code:
code:
Edit: hmm I suppose I could use something like this. code:
Nolgthorn fucked around with this message at 02:15 on Apr 3, 2010 |
# ? Apr 3, 2010 02:08 |
|
Try skipping :url thing completely. Rails sometimes is smart enough to figure out it:code:
|
# ? Apr 3, 2010 16:17 |
|
It's smart enough to figure it out if you tell it how to figure it out You tell it how to figure it out by using REST and map.resources :page in your routes. Then rails knows exactly what to do whenever you call link_to @page, and you get other helper methods like pages_url, edit_page_url(@page) and such. http://guides.rubyonrails.org/routing.html#restful-routing-the-rails-default Also you're doing validations wrong. Don't generate another entirely different page just because a validation failed. You want a standard REST controller: code:
code:
code:
code:
|
# ? Apr 3, 2010 18:07 |
|
I really appreciate it NotShadowStar. But I've merely simplified all that stuff you wrote, so that it would be easier to answer my more specific question. I'm already using REST and standard restful controllers and error_messages_for and a form partial and those things. When validation fails, the page is refreshed. It doesn't really go to an entirely different page, the update action re-renders the edit page again. Even though a happy bright red message box does indeed appear the form's action parameter changes and points to an incorrect path based on the modified name field in the form. This is because the name field is used to render the model object as a parameter in my model. But I don't really know how to fix it. The best thing would be if I could pick and choose times that to_param renders as the name, or renders as a id. Nolgthorn fucked around with this message at 21:10 on Apr 3, 2010 |
# ? Apr 3, 2010 21:08 |
|
Nolgthorn posted:This is because the name field is used to render the model object as a parameter in my model. But I don't really know how to fix it. The best thing would be if I could pick and choose times that to_param renders as the name, or renders as a id. It doesn't feel too railsy but I've done that in the past by doing page_path(@page.id) for occasions where it needs the id and letting to_param take over in the instances where it doesn't.
|
# ? Apr 4, 2010 20:25 |
|
^^ This. Totally answers my question, it's genius! I totally forgot model_path() accepts strings, integers and the like... this'll only take a bit of changes.
|
# ? Apr 5, 2010 19:32 |
|
Not a joke: Would any goons be interested in helping create a blog engine using rails 3 with a mongodb backend? I hesitate to say that the world needs another blogging engine but rails sure does. I really don't like any of the existing ones.
|
# ? Apr 7, 2010 06:55 |
|
For someone just starting out with rails, do you guys know of any open-source projects or something similar to help someone get some practice using the language? I've been programming for almost 15 years and learning a new language isn't a big deal, but I definitely want to actually have some hands-on experience with this one to make sure I stick with it, and so that I have something to show prospective employers should I look for a rails job in the future.
|
# ? Apr 8, 2010 05:13 |
|
You could write a rails plugin and put it up on github. That or you could figure out and patch some of the bugs on the rails bug tracker. I know they're looking for help with that. You would look like a rails badass if you could say that you contributed to rails core.
|
# ? Apr 12, 2010 04:19 |
|
Hello. The solution may be just out of my reach... I've slept on it, woken up and still remain confused about how to solve it. :wall: I have three models :page, :chunk and :cut_text Chunk is a crazy model. It has two polymorphic associations :chunkable and :cutable :page is a :chunkable and :cut_text is a :cutable. :chunk is acting right now as sort of a habtm between :page and :cut_text. :cut_text and :chunk are both created at the same time when creating a :cut_text. :chunk contains a few nested attributes that appear on the :cut_text form. When creating a new :cut_text; 'accepts_nested_attributes_for :chunk' allows :chunk attributes to be applied to a new :chunk. I've added validation to :chunk which validates both :chunkable and :cutable have been applied. code:
It is necessary I specify '@cut_text.chunk.chunkable = @page' somewhere as to ensure the new nested :chunk object contains a :chunkable object and passes validation before @cut_text can be saved successfully. But the chunkable attribute is not accessible due to attr_accessible which is trying to prevent users from modifying the value. I cannot call update_attribute after the record exists as the record will never validate. How do I tell rails that it's ok to set the :chunkable attribute before saving the :chunk, while still using attr_accessible and validation?
|
# ? Apr 15, 2010 21:30 |
|
Nolgthorn posted:] You can't. The solution is probably to just be careful in the controllers (setting the value in the hash yourself) and take out attr_accessible.
|
# ? Apr 17, 2010 15:47 |
|
Operation Atlas posted:You can't. The solution is probably to just be careful in the controllers (setting the value in the hash yourself) and take out attr_accessible. I realized there is probably no reason to use validations on something that users cannot access. I chose to put the changes inside of a transaction ensuring both objects are accounted for. Nolgthorn fucked around with this message at 22:53 on Apr 17, 2010 |
# ? Apr 17, 2010 22:51 |
|
I've been out of the RoR loop for a long while. I just deployed a tiny serverside app for an iPad app I wrote, and it was a huge pain to deploy on my Joyent lifetime account. Heroku looks absolutely amazing - I love that deployment is just a git push. But I have one snag... This app depends on push notifications and is really really latency sensitive. When I want to send a push notification it needs to be sent right away. However, Apple requires that push notification providers hold the connection to the service open as long as possible, rather than opening a new one for every notification. All the current Rails implementations for the APNs use a queue/cron system to batch notifications up in order to get around this requirement. I ended up writing a daemon that maintains the connection to their servers forever, and communicating with it through a named pipe in the app. That works really well for the environment I'm in. However, I'm on a lifetime shared hosting account with low limits. If this app takes off, I'll be screwed if it hammers my servers too much, and have to move it somewhere else (which is sort of a problem I'd like to have...) Heroku looks like a great place to migrate to if this thing gets too big. Hell, I'd use Heroku for what I currently use my lifetime account for, which is basically a dev sandbox. But I'm wondering about how I'd implement what I have already on their service. I see that they allow for worker processes at 5c/hr (which adds up fast monthly) but I'm not sure whether this setup would actually work for me. I read their overview documentation, and it seems like it COULD work - I'd just have to communicate with it through the database rather than the named pipe, which would be some work. But I don't know what the gotchas are there. Has anyone else done something like this on Heroku before? I'm just making sure I have an escape plan if I need it.
|
# ? Apr 18, 2010 04:10 |
|
If something is that sensitive you probably don't want heroku. Look at EC2 or some other VPS-type hosting. I've never done push notifications but it sounds like you're on the right track to have a daemon running that is a broker between the Apple notification service and your app. Also iPhone OS 4 has a local notification daemon that you can use if you can get away with it in your instance. e: Actually I'd make the local app daemon translate Apple push requests into normal REST API requests into your app instead of doing some funky things with sockets and pipes.
|
# ? Apr 18, 2010 08:20 |
|
Sorry, push notifications go the other way - from my app to the daemon to Apple (and then to devices). The latency I was referring to is the delay between when someone hits my app with a browser and the push notification appears on their device. A couple seconds is fine, but anything over about ten and it loses most of its value. So the fifo was the easiest way to do that. I actually just took another Ruby daemon that was already out there but used TCP sockets and ripped the Apple connection code out of there and then wrote the fifo part. Local notifications won't work for this because the push is definitely generated off-device. The app is just an app that lets you click a bookmarklet and then you get a popup on your device that you can press to open the page you were viewing on your computer. I made it mainly because I found that I was doing that all the time by hand, since the iPad is really nice to read the web on. I was mostly just asking to see what the capabilities of the workers were and if they could be expected to live long lives. The architecture looks like they might migrate between servers from time to time.
|
# ? Apr 19, 2010 03:18 |
|
Have you looked at Urban Airship? They have a simple REST API for Apple push notifications and it's free for up to 250k messages per month.
|
# ? Apr 20, 2010 00:00 |
|
|
# ? Jun 4, 2024 12:19 |
|
What is a better way to default to a value in an erb file?code:
|
# ? Apr 21, 2010 20:50 |