|
Newbsylberry posted:MailChimp looks like a good way to go! Thanks for the help. select_tag is its own standalone helper method- it isn't called on a form object. Drop the 'f.'
|
# ? Oct 13, 2013 20:38 |
|
|
# ? May 15, 2024 01:46 |
|
The Journey Fraternity posted:select_tag is its own standalone helper method- it isn't called on a form object. Drop the 'f.' or drop the _tag: code:
|
# ? Oct 13, 2013 21:19 |
|
kayakyakr posted:or drop the _tag: Thanks, this is what I needed!
|
# ? Oct 13, 2013 23:11 |
|
I have a weird issue. I added some code into my project from another developer, and now I'm getting a missing method error in one of the files he changed (though not directly related to his changes). The code runs fine on his box, on another developer's box, and on the test server. It's only my environment having a problem with it. I should note that the same line of code that is throwing the error now, was not throwing an error on my box previously. The error refers to a method in a gem that I've had loaded for some time. I've re-checked out the code, I've run bundle install, etc., but I'm still getting the error. My best guess is that something corrupted the gem in question on my computer. Is there a way to force rails to re-download that gem? Does anyone have any other thoughts or suggestions?
|
# ? Oct 14, 2013 16:06 |
|
Use Vagrant so that you all have the same dev environment?
|
# ? Oct 14, 2013 16:13 |
|
So I'm looking to host a rails4 app, and I'm not really sure what my options are. I am using heroku right now, but it's expensive and I want to use ec2, or elastic beanstalk instead. I followed the steps in this post http://stackoverflow.com/questions/15535140/installing-ruby-2-0-and-rails-4-0-0beta-on-aws-ec2 , and installed ruby and rails on an ec2 instance. I guess I'm not really sure what the next steps are, I think I have to use passenger, and/or nginx? I am having a hard time just figuring out where to start.
|
# ? Oct 16, 2013 02:44 |
|
Newbsylberry posted:So I'm looking to host a rails4 app, and I'm not really sure what my options are. I am using heroku right now, but it's expensive and I want to use ec2, or elastic beanstalk instead. I followed the steps in this post http://stackoverflow.com/questions/15535140/installing-ruby-2-0-and-rails-4-0-0beta-on-aws-ec2 , and installed ruby and rails on an ec2 instance. I guess I'm not really sure what the next steps are, I think I have to use passenger, and/or nginx? I am having a hard time just figuring out where to start. if you're using elastic beanstalk, you can use their git plugin to push to ebs. It's not super flexible (ruby 1.9.3, RDS database, passenger w/ embedded nginx, limited options for DNS), but it's almost as easy as heroku: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html For a "grown-up" deploy I would suggest learning capistrano, nginx, unicorn or thin or puma, and rvm or rbenv or whatever your preference is. You can deploy that to ec2, linode, digitalocean, or whatever your choice of virtual server is.
|
# ? Oct 16, 2013 02:55 |
|
kayakyakr posted:I would suggest learning capistrano, nginx, unicorn or thin or puma, and rvm or rbenv or whatever your preference is. Awesome, do you have a specific recommendation for one? Or is it just a preference? I use rvm now, so I'm familiar with it. Edit - Actually I see I'll need to use a combination of them Newbsylberry fucked around with this message at 03:11 on Oct 16, 2013 |
# ? Oct 16, 2013 03:04 |
|
Newbsylberry posted:Awesome, do you have a specific recommendation for one? Or is it just a preference? I use rvm now, so I'm familiar with it. I use capistrano, nginx, unicorn, and rvm on digital ocean. Capistrano has plugins for unicorn and rvm and bundler that make it pretty easy to get a server going. I'm curious about puma, but they say that it's best with jruby and since I use MRI, I've never really tried it.
|
# ? Oct 16, 2013 03:16 |
|
Another weird issue. We have code:
code:
Edit: This wasn't an issue until the other developer implemented logins with the devise gem. So it's possible that there's actually an issue with that, or with its interaction with LDAP or with the CSRF protection. Peristalsis fucked around with this message at 21:29 on Oct 16, 2013 |
# ? Oct 16, 2013 19:10 |
|
Gmail/spam question. I've got a small application, sending emails 4-5 times per week to a list of 100-200 addresses(all individual emails, no CC/BCC). The list is constant, it's essentially an internal newsletter for an NGO and some of its associates. It seemed to me like it would be the type of thing that a Gmail business account would be perfect for. Unfortunately, the one I created(but still using in trial mode) for the app just started bouncing some emails we're sending(75 from the last batch bounced with a "Message Rejected" response and a link to Google's spam policy). Is it extra sensitive because I haven't setup payment for it yet or can Google Apps just not handle any sort of email volume? No point even bothering to pay for the Apps account if I have to use Mailchimp anyway.
|
# ? Oct 18, 2013 01:20 |
|
It's probably both. The newness of your account is a key marker for spam, as is the low volume. You should look at going through mailchimp, sendgrid, or similar. Also make sure you've setup DKIM, SPF, etc.
|
# ? Oct 18, 2013 04:48 |
|
Dangerllama posted:It's probably both. The newness of your account is a key marker for spam, as is the low volume. You should look at going through mailchimp, sendgrid, or similar. Also make sure you've setup DKIM, SPF, etc. Hmm, I actually didn't know what DKIM or SPF were. Hopefully after I set those up the Apps account will be fine. I think the problem must be with my setup since the customer has been sending out cc/bcc emails to this list from his personal gmail account for a year with no bounce issues.
|
# ? Oct 18, 2013 11:52 |
|
Kayakyakr helped point me in the right direction with this: https://coderwall.com/p/yz8cha tutorial. I am setting up the server on digital ocean, and everything is working smoothly, until this last step where you erase the default nginx sites-enabled: sudo rm /etc/nginx/sites-enabled/default . After that I can't seem to access the IP, Domain Name, or anything else, even after I restart the Nginx server. Anyone run into this problem?
|
# ? Oct 21, 2013 18:01 |
|
Do you have a site in sites-enabled? Is it listening to port 80? Is port 80 open in the firewall?
|
# ? Oct 21, 2013 19:12 |
|
Newbsylberry posted:Kayakyakr helped point me in the right direction with this: https://coderwall.com/p/yz8cha tutorial. Took a glance at this guide, it doesn't appear to have you set up WAL shipping and periodic base backups to reduce recovery time. Also be sure to use postgres 9.3 and turn on checksumming, the guide seems like it's having you install 9.1 which is now several years old. I'm not sure what the latency from digital ocean to s3 is, but if writing to s3 is fine, use wal-e. If you're just screwing around with a hobby thing for fun, I suppose it doesn't really matter, though. Just apt installing postgres is fine then. Sorry, this is just my periodic oh-my-god-wale-has-saved-our-asses-so-many-times post.
|
# ? Oct 21, 2013 20:19 |
|
kayakyakr posted:Do you have a site in sites-enabled? Is it listening to port 80? Is port 80 open in the firewall? I do have a site in sites-enabled, and firewall is good, when I open the site-enabled file using nano the file appears to be blank? Could this be a permissions problem? Here is my nginx_conf file (could the problem be that my server_name is futureyoungpros.com and my site-enabled is futureyoungpros?): code:
|
# ? Oct 21, 2013 21:16 |
|
sites-enabled is a directory. What you want is a file inside that directory.
|
# ? Oct 21, 2013 21:21 |
|
I would go ahead and have your server listen to all: server_name _; This will answer all requests which is what you want since you're not going to be hosting any other sites on there. And that's not your nginx.conf file, right? that should be a file in sites-available named futureoungpros that's symlinked into the sites-enabled directory?
|
# ? Oct 21, 2013 21:54 |
|
kayakyakr posted:I would go ahead and have your server listen to all: That's my nginx.conf file on my local machine EDIT - The sites available folder is completely empty besides the default, so there is nothing in the sites-available and an empty file in the sites-available folder EDIT2 - Thanks to Kayakyakr for figuring out the issue I was having. I wasn't creating a sites-available file with my configuration settings in /etc/nginx/sites-available. Newbsylberry fucked around with this message at 17:04 on Oct 22, 2013 |
# ? Oct 21, 2013 22:24 |
|
loving Rails 4. Spent like 8 hours upgrading an app from 3.2.14. Premailer doesn't work, ActiveAdmin filters error the gently caress out due to my multi-select hack, god knows what other bullshit is breaking. At least reverting back is only a 10 minute thing.
|
# ? Oct 30, 2013 04:12 |
|
Does anyone have any experience using friendly_id's history feature? I've got an app now using friendly_id already for slugs on an articles system. Unfortunately I'm having a hard time understanding the implementation of history -- I need to create a new table it seems, but then do I define the validation logic myself in my article model?
|
# ? Oct 30, 2013 15:23 |
|
So after spending 3 or so really quite happy years dumping Rails in favor of Python/Django, I've been pulled back in to Rails. I just wanted to vent a little:
I used to really really like Rails - before my Django defection I had (I think) 4-5 years working with it. But coming back to it now feels like running into a high school acquaintance that failed to grow up at all for the last 20 years and it's just sad and depressing. Maybe I'm just becoming a crusty old neckbeard but I seem to be loosing my tolerance for these juvenile little hipster software projects where everything has to be cool and meta and we are far more concerned with writing executable code poems than such pedestrian concerns as consistency and clarity. Node.js I'm looking at you too here, jesus christ, talk about something with absolutely no redeeming qualities. Ok, like I said, just venting. Yeah yeah, some people write reasonable ruby, yeah yeah language isn't as important as how you actually use it, yeah yeah, why don't I just go back to python if I love it so much. It's fine, I'll be fine, I'm just not happy about it is all.
|
# ? Nov 2, 2013 01:01 |
|
I haven't seen any libraries instance_evaling a block in a while. What library is doing that evil trick? It used to be somewhat popular in the past, but I guess most people realized that it's just a bad idea.
|
# ? Nov 2, 2013 01:35 |
|
Smol posted:I haven't seen any libraries instance_evaling a block in a while. What library is doing that evil trick? It used to be somewhat popular in the past, but I guess most people realized that it's just a bad idea. devise is doing something weird with block_scope. And yeah I definitely see people backing away from that mindset, I guess I was just sort of hoping it would have died by now
|
# ? Nov 2, 2013 01:50 |
|
I'm having trouble getting my poo poo working! What I'm trying to do is have a comment box appear via ajax in a comment thread(which works for users who are signed in) after somebody signs up/logs in via facebook(which also works), using the facebook javascript sdk. What isn't working is whats happening in between. The way its set up is in the user authorization controller's create method, I do a check for the request format(json for the in-thread sign up/login, and text/html for when it's called from the actual sign up/login page), and depending on which it is I either do a redirect for the html call, or a respond_to with a success code for the ajax call, which is then checked in the javascript function. The javascript function is then supposed to call the function which displays the comment box. When I call it via a comment thread it displays the sign up with facebook popup, and after entering my facebook credentials it just does the login, but doesn't display the reply box(once I do a full pageload, I'm logged in via facebook.) The function being called to display the comment box is bound to the window, and when I check in the dev console the window does have access to it. My question: does anybody have any ideas for how to debug this? I'm using RubyMine to debug the ruby code, and the chrome dev console to debug the javascript, so its a bit hairy trying to combine the two. The javascript function which sends out the facebook login request and subsequently checks for the success code from the authorization create method is doing both of those things correctly, and definitely has access to the function for displaying the reply box, but I can't think of a good way to figure out where the son of bitch is dying. I know this is pretty vague, but I hope somebody will be able to at least point me in the right direction.
|
# ? Nov 6, 2013 04:40 |
|
Gripe: When I develop object-oriented backend systems in a framework-agnostic manner, I am able to decouple objects and generally decompose problems in a sensible, maintainable way. However, whenever I write rails apps, database persistence usurps all other considerations and invariably winds up dictating the structure of the system. The Rails Way always seems to result in a flat collection of strongly-connected models. It's never pretty and it's often not the way I would model the system if I didn't have to map it to a database schema. Things would often look very different if objects weren't mapped to a schema. Have you seen any examples of rails applications that are cleanly decomposed and don't seem like spaghetti balls of strongly-connected models?
|
# ? Nov 6, 2013 09:37 |
|
Jam2 posted:Have you seen any examples of rails applications that are cleanly decomposed and don't seem like spaghetti balls of strongly-connected models? I don't have any examples in public code, but there's nothing stopping you from decoupling stuff into non-persisted classes. I'd say that except for trivial cases, it's more idiomatic to do so than to just try and jam a whole family of methods on to a model that it might not quite fit on.
|
# ? Nov 6, 2013 16:12 |
|
Jam2 posted:It's never pretty and it's often not the way I would model the system if I didn't have to map it to a database schema. Things would often look very different if objects weren't mapped to a schema. Data you want to persist is mapped to a database schema, not particularly differently from any other serialization strategy. Though whole objects worth of data are frequently persisted, you don't have to persist all or even any of an object's data. I'm not trying to be an rear end—this is a conceptual issue I frequently encounter in the wild—but you do realize model classes are just Ruby classes, right? They can (and frequently should) do more than be a thin veneer over ActiveRecord/Mongoid/DataMapper/whatever. Rails doesn't care what else you make that class do. ActiveModel and the mappers implementing it don't care what that class does. Rails doesn't even care if models use a particular mapper (or any mapper) or are persisted at all; if it's in the models directory and it's Ruby code, it's loaded. Notably, Rails 4 natively autoloads service object classes from a services directory. The modern Rails Way is decomposition and coupling as loose as you can get it. Molten Llama fucked around with this message at 16:58 on Nov 6, 2013 |
# ? Nov 6, 2013 16:34 |
|
Molten Llama posted:Data you want to persist is mapped to a database schema, not particularly differently from any other serialization strategy. Though whole objects worth of data are frequently persisted, you don't have to persist all or even any of an object's data. Good post. Rails is as flexible as you want it to be. Most rails apps people come up with are just front ends to a database schema and so they wind up reflecting the database. This should be a surprise to absolutely no one and I've seen the same setup used in languages and setups that aren't rails written with a lot more code. Database-wise, ActiveRecord does encourage a pretty decent bit of normalization, and as a SQL guy, I approve of that direction heartily.
|
# ? Nov 6, 2013 18:02 |
|
Molten Llama posted:
Thanks for the great reply. Do you recommend any resources for learning how experienced rails users model their backends to achieve what you describe? Or is it simply trial and error and experience?
|
# ? Nov 6, 2013 23:26 |
|
We have a shiny new RoR app with a web interface and a webserivce API for backend access. I want to adapt an old Ruby script (no Rails) to use that API, but it'll be a lot easier if I can use some of the model classes from the web app to do some parsing and processing. This is a completely different app, running in a different directory (probably even on a different server). Is there a good way to import some of my ActiveRecord models from the Rails app to use in plain Ruby? I really don't want to re-write all the necessary logic.
|
# ? Nov 7, 2013 21:03 |
|
Peristalsis posted:We have a shiny new RoR app with a web interface and a webserivce API for backend access. I want to adapt an old Ruby script (no Rails) to use that API, but it'll be a lot easier if I can use some of the model classes from the web app to do some parsing and processing. You can create a gem with those models extracted out. You'll have to require all the necessaries in order to set up ActiveRecord, the database connections, etc for the non-rails app, but it'd be doable.
|
# ? Nov 7, 2013 21:34 |
|
In Ruby, I have a ASCII-8bit stream that contains a xls workbook. I want to open the workbook via the Workbook gem, but it requires a file. Is there a way I can read the stream into a file object without actually writing it to disk? This link seems close to what I am trying http://stackoverflow.com/questions/5931263/memory-streams-in-ruby e: I tried it and it almost works. The Workbook gem tries to do a rewind on it, and I get an "Illegal Seek" error. https://github.com/zdavatz/spreadsheet/blob/master/lib/spreadsheet/excel/reader.rb#L1198 KoRMaK fucked around with this message at 21:02 on Nov 8, 2013 |
# ? Nov 8, 2013 20:27 |
|
KoRMaK posted:In Ruby, I have a ASCII-8bit stream that contains a xls workbook. I want to open the workbook via the Workbook gem, but it requires a file. Is there a way I can read the stream into a file object without actually writing it to disk? This link seems close to what I am trying http://stackoverflow.com/questions/5931263/memory-streams-in-ruby You could try wrapping it in a delegator that declares rewind as a noop.
|
# ? Nov 8, 2013 23:31 |
|
If you want to read the entire stream in and then use it as if it were a file, check out StringIO. It responds to #rewind and all the other File/IO-ish methods.
|
# ? Nov 9, 2013 01:44 |
|
Jam2 posted:Thanks for the great reply. Do you recommend any resources for learning how experienced rails users model their backends to achieve what you describe? You want to read the book Objects on Rails, which is free online. You also probably want to watch some of the Destroy All Software screencasts, which are not free but are worth the money. Russ Olsen's book "Design Patterns in Ruby" is also a good read. "Skinny controller fat model" was a really popular concept a few years ago and really set Rails back a bit since everyone would just jam everything into the model. I inherited a project that has a 1000-line model. My opinion is that if it's not directly related to getting and storing objects in the database it belongs elsewhere.
|
# ? Nov 10, 2013 17:18 |
|
Hey guys, Routes in Rails have long confused the poo poo out of me, and I'm now working in my first Rails 4 app. I have some experience in Rails 3, though I'm currently strongest writing pure Ruby. Regardless, this app I'm writing maintains a list of applications. To reduce potential internal Rails Deep Logic naming collisions, I'm referring to the controller and model for this element as one thing internally but want the URLs to read to the user as something else. Because I think an example will help illustrate, let's say I have a model called MyApp, the controller for that as MyAppsController, and I want the user to be able to access that resource through http://address.what/apps. Right now, in my Routes.rb file I've got: Ruby code:
edit: I worked this out, mostly. I did my best to comprehend that routes guide. I needed to add :as to my route, like so: Ruby code:
Fillerbunny fucked around with this message at 21:20 on Nov 10, 2013 |
# ? Nov 10, 2013 20:21 |
|
Soup in a Bag posted:If you want to read the entire stream in and then use it as if it were a file, check out StringIO. It responds to #rewind and all the other File/IO-ish methods. Now I have a public staging/development area and a production are on heroku. Heroku offers a nice easy way to manage which app you are managing. I needed to get my DB up and it just requires adding -app APPNAME at the end of the commands. I have another problem with an app I've already deployed to heroku that I am creating a new instance of and for some reason it fails at the assets:precompile step. Here's the push log I get code:
e: Fixed! There was a comma where a semi-colon should have been in bootstrap.css. When I run rake assets:precompile locally I get this quote:Text file busy - (/media/sf_clunker/tmp/cache/sass/1764c37ed8cf48e1638694abf11caad17c086877/gritter.css.scssc20131110-2125-a7ip2g, /media/sf_clunker/tmp/cache/sass/1764c37ed8cf48e1638694abf11caad17c086877/gritter.css.scssc) Text file busy? KoRMaK fucked around with this message at 05:41 on Nov 11, 2013 |
# ? Nov 11, 2013 04:36 |
|
|
# ? May 15, 2024 01:46 |
|
prom candy posted:You want to read the book Objects on Rails, which is free online. You also probably want to watch some of the Destroy All Software screencasts, which are not free but are worth the money. Russ Olsen's book "Design Patterns in Ruby" is also a good read. Fantastic recommendations. Thank you very much. I'm only 10 pages in, and Objects on Rails is already moving me forward. Objects on Rails is a spiritual experience. Thank you based god. Jam2 fucked around with this message at 06:45 on Nov 12, 2013 |
# ? Nov 11, 2013 05:54 |