|
We use redmine for lots of stuff here at the office. And we upgraded to redmine 2.0 recently which uses erb for it's views. Unfortuantely, it seems that the ActionMailer views are getting html escaped for plain text and we went plain text on the emails to kill ingest issues. So, I've figured out enough to know I can go in and edit the .text.erb files in the mailer's views folder. But I was wondering if there was a more elegant approach available. I know very little ruby but I can pick up languages fast and I've got alot of experience with other mvc platforms so you can speak fast and use big words.
|
# ? Oct 17, 2012 15:35 |
|
|
# ? May 30, 2024 07:32 |
|
A MIRACLE posted:It's what happens when you decide to outsource development to a team of Eastern Europeans who don't speak English (our image gallery is spelled "Galery.rb") or care about things like unit test coverage, standards or best practices, and think it's okay to write 500 character SQL queries on a single LOC. Oh man, you should see the SQL query we inherited (from a project originally developed by another company). It's 14 A4 pages long and is framed on the walls of our office. The project also comes with a 3 kLOC method that generates the query.
|
# ? Oct 17, 2012 22:58 |
|
A MIRACLE posted:It's what happens when you decide to outsource development to a team of Eastern Europeans who don't speak English (our image gallery is spelled "Galery.rb") or care about things like unit test coverage, standards or best practices, and think it's okay to write 500 character SQL queries on a single LOC. FWIW all of these horrible things (can't spell, insanely long lines, no thought about best practices, 0 unit tests) and more are at my workplace in the united states. it has nothing to do with them being ESL eastern europeans (who write some pretty good code for us)
|
# ? Oct 18, 2012 01:14 |
|
So, turns out my issue was fixed in the next version which we aren't on yet. Doh. Disregard .. . PS: speaking of lovely devs, we've now got a dedicated "Small Business Designer Develper" running our web shop who thinks valid database update procedures include mysql dump and valid editors include MySql Workbench. And he looks at me like I killed his kitten when I insist on source control and CI setups. wwb fucked around with this message at 01:24 on Oct 18, 2012 |
# ? Oct 18, 2012 01:21 |
|
^^ Is MySql workbench really that bad? I've never used it, but assumed it was the de facto standard tool.
|
# ? Oct 18, 2012 03:36 |
|
Lexicon posted:^^ Is MySql workbench really that bad? I've never used it, but assumed it was the de facto standard tool. I've just inherited a rails app and for some reason the browser history is totally broken. You can navigate around the site just fine, but the URL in the URL bar never changes to anything other than the site root. I'm not really a javascript guy, but I'm assuming there's some javascript fuckery going on here. Can anyone point me in the right direction for sorting this out?
|
# ? Oct 18, 2012 14:20 |
|
Is it a single page javascript app? Is it in a frame? Post some code probably.
|
# ? Oct 18, 2012 14:30 |
|
Lexicon posted:^^ Is MySql workbench really that bad? I've never used it, but assumed it was the de facto standard tool. I basically never have to touch the SQL (or other direct database interaction) of a Rails application working normally, including during schema changes. Using the Rails console and proper abstractions not only allows me to write tests that validate my changes, but also keeps me from doing a stupid UPDATE or DELETE command on the production database. Is it a bad tool? Who cares! It's the wrong tool.
|
# ? Oct 18, 2012 19:34 |
|
I'm considering learning ruby/rails via running this forum app in a live environment with a couple dozen users. Modifying and upgrading features over time. What could go wrong!? Symposium posted:Hobo is located at https://www.hobocentral.net - might want to edit your link. ...any advice / comments / insults ? edit: Github: https://github.com/danneu/symposium Computer Serf fucked around with this message at 07:59 on Oct 19, 2012 |
# ? Oct 19, 2012 07:18 |
|
Why learn with Hobo? I remember running into it when I first started as well, but I decided to learn RoR with just RoR, no fancy additions. Does Hobo offer something I am not aware of? Is it used in a lot of production apps (their gallery is pretty sparse)?
|
# ? Oct 19, 2012 07:49 |
|
Oh My Science posted:Why learn with Hobo? Sorry, I forgot to include the Github project link that includes all the Hobo modules into the "Symposium" forum app
|
# ? Oct 19, 2012 08:00 |
|
Lexicon posted:^^ Is MySql workbench really that bad? I've never used it, but assumed it was the de facto standard tool. MySql workbench is a great MySql management and troubleshooting tool. It is not meant to be your CMS admin tool in this developer's opinion. No that we'd never let the designers closer than a reviewed sql script to the actual production database. When I mentioned rails to the guy he got scared. Little too much formality it seems.
|
# ? Oct 19, 2012 12:25 |
|
Can anyone give me some tips on speeding up Rails 3 apps in development mode? We have Ruby 1.87 and while our Rails 2 apps are fine, I literally wait 20-40 seconds to re-load a page in development mode on my machine. The apps run fine our production server which is a 2.26GHz Xeon on RHEL 5 (L5520), but on either development machine I use, they're mind-numbingly slow. One is a Mac with 3.06GHz i3, 8GB, SSD, the other is a C2Q with 6GB running CentOS 6.3 The development DB is a MySQL server on the LAN and it seems pretty fast, it's just the rendering. If I do a ColorBox and put 'hello world' in it, it's like it takes 10 seconds to fill the box. I just installed thin and am trying that instead of Webbrick and it's not noticeably faster.
|
# ? Oct 19, 2012 14:43 |
|
Have you tried https://github.com/thedarkone/rails-dev-boost If that doesn't work you'll probably need to profile your requests somehow to figure out where the slowdowns are happening. Does it happen if you don't use the asset pipeline?
|
# ? Oct 19, 2012 14:58 |
prom candy posted:Have you tried https://github.com/thedarkone/rails-dev-boost If he's on Rails 2 he doesn't have the asset pipeline, which only came about after Rails 3.1. That plugin looks interesting. It reminds me of how Scribd handled development mode (they have a huge Rails 2 app). They basically ran a watch script (think SASS compiler) that monitored and reloaded classes only when they were modified, instead of dumping the whole app and reloading every class per request. It's an interesting problem.
|
|
# ? Oct 19, 2012 15:09 |
|
prom candy posted:Have you tried https://github.com/thedarkone/rails-dev-boost Wow, that made a huge improvement. I guess I won't be drinking before lunch.
|
# ? Oct 19, 2012 15:24 |
|
Bob Morales posted:Can anyone give me some tips on speeding up Rails 3 apps in development mode? It's in development mode, so it's re-loading everything on every request. How many models and other classes do you have? Also, it's in development mode, nobody but you is gonna complain if you profile it and find out where the speed problems are.
|
# ? Oct 19, 2012 16:22 |
|
I think I did a bad thing. This morning, mysteriously my rails server wouldn't start. It was bombing out with the message /Users/ShameBoner/.rvm/gems/ruby-1.9.3-p286@rails_3_2/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- trace_nums (LoadError). I suspect that I properly hosed my gemset by doing a bundle update while rubygems.org's dependency API is down. I'm not sure what gem is responsible for the TraceNums class, but it seems to be missing. Is there any way to un-gently caress this gemset? For the time being, I had to go back to using my 1.9.2 version of Ruby.
|
# ? Oct 19, 2012 17:03 |
Shame Boner posted:I think I did a bad thing. This morning, mysteriously my rails server wouldn't start. It was bombing out with the message /Users/ShameBoner/.rvm/gems/ruby-1.9.3-p286@rails_3_2/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- trace_nums (LoadError). I suspect that I properly hosed my gemset by doing a bundle update while rubygems.org's dependency API is down. I'm not sure what gem is responsible for the TraceNums class, but it seems to be missing. Is there any way to un-gently caress this gemset? For the time being, I had to go back to using my 1.9.2 version of Ruby. That's always fun. I hope this isn't for a big project because it could get a little hairy. If your Gemfile.lock is in version control you can look at a previous version where everything was working, then manually go through your gemfile, setting specific versions of all your gems. From there just update as necessary.
|
|
# ? Oct 19, 2012 17:06 |
|
Shame Boner posted:I think I did a bad thing. This morning, mysteriously my rails server wouldn't start. It was bombing out with the message /Users/ShameBoner/.rvm/gems/ruby-1.9.3-p286@rails_3_2/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- trace_nums (LoadError). I suspect that I properly hosed my gemset by doing a bundle update while rubygems.org's dependency API is down. I'm not sure what gem is responsible for the TraceNums class, but it seems to be missing. Is there any way to un-gently caress this gemset? For the time being, I had to go back to using my 1.9.2 version of Ruby. You can try adding source "http://bundler-api.herokuapp.com" to your gemfile. It is another api endpoint that is up to date as of last night. It is just a proof of concept though, and isn't like a real real thing, but could get you going.
|
# ? Oct 19, 2012 17:11 |
|
Bob Morales posted:Can anyone give me some tips on speeding up Rails 3 apps in development mode? Are you using a local redis or memcached? Sometimes a reference to localhost will be resolved as its v6 IP (::1) and those normally only bind to 127.0.0.1. Get off Ruby 1.8.7, just upgrading to 1.9.3 will get you some decent gains.
|
# ? Oct 19, 2012 21:16 |
|
I'm trying to understand how to implement click-to-edit functionality. I've seen some gems suggested for doing this, but since the purpose of the project I'm working now is to teach myself how to use RoR, I'd prefer to at least learn an implementation from scratch. What I have so far is a page -- let's call it Edit Recipe -- that then allows a user to add and remove both Ingredients and Directions / Steps. I've been able to get far enough as to implemnent this functionality using AJAX, but now I've hit a wall when trying to implement a way to edit pre-existing data for each item. Say a user has entered a recipe direction -- I'd like to give them the ability to click on an edit call to action and then be able to change the content of the direction, submit and have it be saved. Where I'm failing now is in getting the form partials -- let's use the _form for Directions as an example -- to render in the context of an Edit. So, say I have 4 directions listed, I do get a form rendered for each, though the form is for a create new direction, not an update existing. So now, what I need to understand is what should be happpening to get those Direction forms to understand they should be appearing with the data for their respective record when they are placed into the DOM, AND also understand that on post, they are to edit their respective Direction record. The way the forms currently get placed is via a line of JavaScript that goes like this: $('#direction_<%= direction.id %> .edit').click(function(){ $('#direction_<%= direction.id %>').append("<%= escape_javascript(render :partial => 'directions/form', :locals => { :direction => direction }) %>"); }); ...and then the partial for my Direction _form (currently) looks like this: <% if defined? direction %> <%= form_for :direction, :url => { :action => 'edit', :id => direction.id }, :remote => true do |f| %> <div class="input-append"> <%= f.text_field :content, :class => 'input-xlarge' %> <%= f.submit :value => 'save', :class => 'btn' %> </div> <% end %> <% else %> <%= form_for([@recipe, @recipe.directions.build], :remote => true) do |f| %> <div class="input-append"> <%= f.text_field :content, :class => 'input-xlarge' %> <%= f.submit :value => 'add', :class => 'btn' %> </div> <% end %> <% end %> ...where I'm trying to at least pass the Direction object along, thinking that's all the partial needs to render as an edit form. Of course now I have the problem of this not working, the form still thinking it's posting a new direction, and not editing a pre-existing one, so I'm missing something big on defining the controller resources to use for the form maybe? I was under the impression the partials would be conscious of a Direction object, and just do their thing automagically. Lots I'm doing wrong practice wise too maybe -- for example, the contextual partial for the Direction _form seems awkward, but maybe that's the way to do this sort of thing? EDIT: Sorry for the ugly formatting. Copypasta skills need some work too it looks like... mmachine fucked around with this message at 15:50 on Oct 22, 2012 |
# ? Oct 22, 2012 15:43 |
Wow, that seems kind of awkward, I didn't know people still inlined ruby in their javascript code. I hate to recommend js frameworks since it seems like you're already really far along with this method, but I've been really happy using either Angular, Backbone, or Knockout.js (with underscore.js as a utility belt) for my ajax-y goodness.
|
|
# ? Oct 22, 2012 15:51 |
|
A MIRACLE posted:Wow, that seems kind of awkward, I didn't know people still inlined ruby in their javascript code. I hate to recommend js frameworks since it seems like you're already really far along with this method, but I've been really happy using either Angular, Backbone, or Knockout.js (with underscore.js as a utility belt) for my ajax-y goodness. Ha! Well it definitely felt awkward. I'm not opposed to using a JS framework, though I'm wondering if understanding how this works without the framework in place yet will get me a better handle on how these things talk together.
|
# ? Oct 22, 2012 15:59 |
|
mmachine posted:Ha! Well it definitely felt awkward.
|
# ? Oct 22, 2012 16:08 |
mmachine posted:Ha! Well it definitely felt awkward. Well the way I use them is, I basically treat Rails like an API / REST layer with routing and business logic, and then the js on the front just talks to Rails. I think (Backbone || Angular) + underscore would be a good starting point if you're actually interested in using a js framework. I've used Knockout extensively but that was with .NET, not sure how well it gels with Rails.
|
|
# ? Oct 22, 2012 16:17 |
|
Knockout itself is quite platform independent, but it comes from a very MS background (MVVM on Silverlight and WPF apps) so it tends to get tied up in MS web technologies. But I don't see any reason that you couldn't use it with rails presuming you got your rails setup right.
|
# ? Oct 22, 2012 17:18 |
|
Cocoa Crispies posted:Without the framework, it feels like a huge obtrusive hack. Send the form in a script when the page first loads, and use JavaScript to activate it when the click to edit field is clicked on. Never even thought about it this way, but this makes a lot of sense. Sounds like you're saying by the time I figure out to get this all working via RoR my long way, I'll just want to start tying in a framework to alleviate tedium. Sound about right? As far as JS frameworks go, I've liked what I've seen of Angular so I think I'll start there.
|
# ? Oct 22, 2012 17:42 |
|
mmachine posted:I'm trying to understand how to implement click-to-edit functionality. I've seen some gems suggested for doing this, but since the purpose of the project I'm working now is to teach myself how to use RoR, I'd prefer to at least learn an implementation from scratch. Have you looked at the railscasts cast on this topic? http://railscasts.com/episodes/136-jquery-ajax-revised
|
# ? Oct 22, 2012 22:35 |
|
Here's what I think is turning out to be a crazy question: how do I embed ruby tags in a string? For example I want to do this something.html.erb Ruby code:
Physical fucked around with this message at 14:21 on Oct 24, 2012 |
# ? Oct 24, 2012 14:06 |
|
Physical posted:Here's what I think is turning out to be a crazy question: how do I embed ruby tags in a string? What are you %q{}ing for anyway? Is there something important you're not telling us? Ruby code:
|
# ? Oct 24, 2012 14:17 |
|
Yea I want to store these fields in an array so I can rearrange them later. I'd rather not use partials for this. So what you see me doing is trying to store an input field in a string so I can put that in an array, then output them later at will. e: It's in an html.erb btw. ee: Here is what worked: Ruby code:
Physical fucked around with this message at 15:31 on Oct 24, 2012 |
# ? Oct 24, 2012 14:21 |
|
You might want to use a helper or something for this, you're going to punch yourself in the face when you have to edit that code in six months.
|
# ? Oct 24, 2012 15:59 |
|
prom candy posted:You might want to use a helper or something for this, you're going to punch yourself in the face when you have to edit that code in six months.
|
# ? Oct 24, 2012 16:02 |
|
Physical posted:What would the helper do? I intended to make some helpers since this was going to be used more than once and dynamic, but I'd like to know what you would suggest?
|
# ? Oct 24, 2012 16:14 |
|
A few questions for you, Physical: Why do you want to put it in an array? Why don't you want it in a partial? Or more generally: What's the view functionality you're trying to achieve? I'm sure that what you want to do is possible (you already have a working version it seems), but this method definitely seems odd and makes me think you've crafted an elaborate solution to something that may already have a simpler, Rails-y solution. In particular I'm wondering if your view is going to involve some big crazy array that has all the html for your page and ends up looking like: code:
|
# ? Oct 24, 2012 16:59 |
|
Siguy posted:A few questions for you, Physical: Physical posted:So what you see me doing is trying to store an input field in a string so I can put that in an array, then output them later at will. Too little for a partial I think because then I would have 9 partials. Then we are going to do this site wide with our other forms. I would love to have a more rails-y way to do this.
|
# ? Oct 24, 2012 17:04 |
|
Generally if you find yourself doing variable assignment in your ERB you're doing something wrong. Here's a really simple example of how to convert what you're doing to helper code, but you can probably clean it up a little better. code:
|
# ? Oct 24, 2012 17:05 |
|
prom candy posted:Generally if you find yourself doing variable assignment in your ERB you're doing something wrong. I owe you more money now.
|
# ? Oct 24, 2012 17:12 |
|
|
# ? May 30, 2024 07:32 |
|
After seeing your other response I really would advise you to put these bits into partials rather than the helper. Partials are great for this kind of thing. I just built a survey-builder type system for an app I was working on and the surveys are all built out of partials, it keeps the code pretty clean.code:
|
# ? Oct 24, 2012 17:18 |