|
Operation Atlas posted:Sorry for the snark, but it's the right answer: No problem, and no apology necessary. I'm relatively new to rails and am still constantly double-checking to make sure I'm doing things the 'right' way. So wasn't sure if there was a better way using RJS, my google searches didn't turn up anything obvious. Thanks again.
|
# ? Mar 6, 2010 20:12 |
|
|
# ? Apr 19, 2024 21:29 |
|
My advice is avoid RJS. I think they went a little to far saying 'ruby for EVERYTHING'. RJS is really confusing and really really badly documented (probably goes along with Prototype is badly documented), wheras putting JS in the view template (or better, a partial that contains the script) is much easier. Rails 3 is much nicer since it doesn't dump Javascript all over the page but instead creates specific named HTML ids and classes that you can use any JS framework you want to target those classes.
|
# ? Mar 7, 2010 00:00 |
|
NotShadowStar posted:My advice is avoid RJS. I think they went a little to far saying 'ruby for EVERYTHING'. RJS is really confusing and really really badly documented (probably goes along with Prototype is badly documented), wheras putting JS in the view template (or better, a partial that contains the script) is much easier. Echoing this. I never really saw the point to writing Javascript hooks in ruby, when it takes around the same amount of code as it does in Javascript. It's just adding an awkward layer of abstraction. Plus out of the box it doesn't support jQuery, which I'd heartily recommend over Prototype.
|
# ? Mar 7, 2010 02:09 |
|
NotShadowStar posted:My advice is avoid RJS. I think they went a little to far saying 'ruby for EVERYTHING'. RJS is really confusing and really really badly documented (probably goes along with Prototype is badly documented), wheras putting JS in the view template (or better, a partial that contains the script) is much easier. There is one exception: when I have a JS partial that I need to throw out on an AJAX request, I do: code:
|
# ? Mar 7, 2010 16:19 |
|
Anyone want to recommend some resources for learning and utilizing Javascript libraries like Prototype and JQuery?
|
# ? Mar 7, 2010 16:27 |
|
The jQuery and JavaScript megathreads in this forum?
|
# ? Mar 7, 2010 20:33 |
|
pokeyman posted:The jQuery and JavaScript megathreads in this forum? didn't even see those
|
# ? Mar 8, 2010 01:12 |
|
Operation Atlas posted:There is one exception: when I have a JS partial that I need to throw out on an AJAX request, I do: Sorry that's still too for me. code:
code:
|
# ? Mar 8, 2010 18:05 |
|
Figured I'd post here before I bothered with it's own thread. I'm a recruiter and I'm looking for some Ruby on Rail developers. Normally I just stick to the normal methods, my company database, job boards and networking sites, but this position has proven more difficult so I though I'd check if anyone here is interested. Anyway, cutting to the chase:code:
Last note, I'll be straight forward that I'd like to stick with candidates in the north east US if possible unless you're extremely well qualified. Thanks.
|
# ? Mar 10, 2010 00:46 |
|
I've got another very rudimentary Ruby question. I'm attempting to access data inside an XML file with Nokogiri. The data is coming back as a Hash with a nested Array. Then, inside that Array is a Hash with another Array nested inside it. Inside THAT Array is a Hash with the data I want to access. Given: code:
|
# ? Mar 10, 2010 19:26 |
|
plasticbugs posted:Given: Does this work? code:
I don't think any of that needs to be parenthesized to work, but I'm not in front of my interpreter right now.
|
# ? Mar 10, 2010 19:34 |
|
I should clarify, I wasn't using Nokogiri. I was using a gem for a specific API, which I'm guessing has its quirks.Flobbster posted:Does this work? Yes, sorry. a, b, and c are strings. EDIT: That's the answer I was looking for. Thanks! EDIT: Deleted stupid question. Learning all this on my own with nothing but some books and Google is challenging, but this thread has been such a huge help. Thanks. plasticbugs fucked around with this message at 09:15 on Mar 12, 2010 |
# ? Mar 10, 2010 20:13 |
|
I'm confused again. Another dumb question: I'm working with a Nokogiri object and am attempting to populate a page with TV episode titles and links to those titles with data from an XML file. This gets all the links: code:
code:
code:
This was my approach to putting the results of both operations into the array above, and it worked, but it seems VERY sloppy: code:
2. Is there a better way to put those results into a structure that I can iterate over in my view to create a list of Episode titles and links? I feel like I'm missing the obvious, easy solution to displaying this data in my view. plasticbugs fucked around with this message at 09:28 on Mar 12, 2010 |
# ? Mar 12, 2010 09:12 |
|
plasticbugs posted:
Try using something like Rack::Cache if your having lag problems and the data doesn't change much http://rtomayko.github.com/rack-cache/
|
# ? Mar 12, 2010 15:27 |
|
After failing spectacularly to grasp the innards of C#, I've run to the glittery arms of Ruby. I'm amazed at how sensible it is, and am looking forward to learning more. Thanks to this thread for reminding me about Ruby! I've learned more Ruby in 3 days than I learned after 3 weeks of C#.
|
# ? Mar 12, 2010 22:35 |
|
Does anyone know of a download mirror for the Ruby on Rails windows installer? The official site (http://rubyforge.org/frs/?group_id=167) says its downloading painfully slow, but its not downloading at all. I also can't seem to find any other place that offers the file.
|
# ? Mar 13, 2010 17:53 |
|
HasidicNeckbeard posted:Does anyone know of a download mirror for the Ruby on Rails windows installer? The official site (http://rubyforge.org/frs/?group_id=167) says its downloading painfully slow, but its not downloading at all. I also can't seem to find any other place that offers the file. I don't mean to derail your question but if your machine can support vm's i would suggest developing in a Ubuntu vm with virtual box if you are on windows some gems just don't play nicely in windows.
|
# ? Mar 13, 2010 19:09 |
|
OK, I'm new to the whole rubygems thing...code:
|
# ? Mar 13, 2010 20:26 |
|
Compass is fantastic. For your problem though, the only thing I can think of is to check your $PATH code:
Also be aware that there have been some important changes between 1.8.6 and 1.8.7. The biggest issue soon is that rails3 will only run on 187. There's a lot of stuff on 6 though, and it probably has nothing at all to do with your gem problem.
|
# ? Mar 13, 2010 20:38 |
|
code:
welp i just removed the apt version of rubygems and re-installed it from source and it works fine
|
# ? Mar 13, 2010 21:34 |
|
nbv4 posted:
rvm, for god's sake, the answer is always
|
# ? Mar 13, 2010 22:59 |
|
I'm checking in to say that I've solved my own problem from a few posts up with regards to creating a hash in one step from an XML file using Nokogiri. For anyone getting started with Ruby or Nokogiri, this may be of some help. Here's my refactored code: code:
|
# ? Mar 14, 2010 22:03 |
|
plasticbugs posted:
code:
|
# ? Mar 14, 2010 22:23 |
|
Pardot posted:You should use Enumerable#map Thanks for this! I'm reading up on it right now.
|
# ? Mar 15, 2010 05:34 |
|
Pardot posted:Compass is fantastic. What is compass anyway? I can see hundreds of blog posts telling me it's awesome, but every post is just 90% "this is how you use sass" and 10% "also it includes a bundled copy of blueprint and 960gs". (Not that sass isn't amazing though.)
|
# ? Mar 15, 2010 17:22 |
|
Sharrow posted:What is compass anyway? I can see hundreds of blog posts telling me it's awesome, but every post is just 90% "this is how you use sass" and 10% "also it includes a bundled copy of blueprint and 960gs". Compass is built on sass. It gives you http://www.blueprintcss.org/ already sassified, and a bunch of general helpers and css3 helpers built in. There are also some libraries built ontop of compass, such as the wonderful fancy-buttons
|
# ? Mar 15, 2010 17:34 |
|
Say I have the following models: Person Job With data: Person: - John - Tony - Bob And Jobs: - Driver - Shipper - Receiver - Cook When I'm creating the actual class for the model, I would have for Person: code:
Now my question is - what if each person has multiple primary Jobs and multiple secondary Jobs? How would that be expressed? Would I need to create a third model called, for example, PrimaryJob that has a Person and Job? Then another one called SecondaryJob with Person and Job indexes? I figure that would work but seems that there should be a way to do that within the Person/Job model without creating the extra model.
|
# ? Mar 18, 2010 04:05 |
|
@job.is_primary as a boolean could work You could also use something like @job.priority, accepting an integer of 1/2/3 for primary/secondary/teartiary. It could also accept a string such as "Primary" or "Secondary" You could also create a third model called Priority (made up of id, name) and assign a @job.priority_id edit: or you could do this! VVVVVVVVV hmm yes fucked around with this message at 13:07 on Mar 18, 2010 |
# ? Mar 18, 2010 04:47 |
|
has_many :x, :through => :y is how to specify extra attributes on the relationship between two other models. Y is its own model with whatever attributes you want for each individual association between a person and a job. I think it works like this:code:
|
# ? Mar 18, 2010 07:52 |
|
If jobs are unique there is no point in the added complexity of a join model.code:
skidooer fucked around with this message at 19:14 on Mar 18, 2010 |
# ? Mar 18, 2010 19:10 |
|
skidooer posted:If jobs are unique there is no point in the added complexity of a join model. For example: John, primary jobs: driver, cook, secondary jobs: shipper Tony, primary jobs: shipper, secondary jobs: cook, receiver Bob, primary jobs: driver secondary jobs: receiver Need to the simplest way to express a many-to-many relationship multiple times that reference the same model.
|
# ? Mar 19, 2010 02:19 |
|
I'm getting a NoMethodError: "undefined method 'connect' for Mysql:Class" when trying to connect to a MySQL database:code:
using Ruby 1.8.7 on OSX SnowLeopard ideas?
|
# ? Mar 20, 2010 00:01 |
|
Valrik posted:I'm getting a NoMethodError: "undefined method 'connect' for Mysql:Class" when trying to connect to a MySQL database: Connect is an instance method. Instantiate an instance of the Mysql class and then call connect on that. That instance will be your "connection", instead of what you thought would be returned by connect().
|
# ? Mar 20, 2010 18:02 |
|
roop posted:That's the whole thing, jobs are not unique and each person has primary jobs and secondary jobs. Read up on has_many :through and do something like what I suggested.
|
# ? Mar 21, 2010 21:01 |
|
trinary posted:Read up on has_many :through and do something like what I suggested. http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off
|
# ? Mar 22, 2010 13:36 |
|
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. I want to make a simple webapp that just does the following: Take a query. Analyze it. Graph the output. All I'm wondering is the relative difficulty and time it will take to implement this, and maybe some suggestions of any graphing packages to use.
|
# ? Mar 26, 2010 01:03 |
|
Alrighty then, I just spent hours bashing my head against my keyboard trying to figure out what was going on and I think I did. However, despite knowing what is wrong, my mind is still being blown. I'm new to ruby so be gentle. I used scaffolding to, well, scaffold. I did this because a book told me to. In the process of this I generated a routes.rb in /config. I kept making links to other pages off of my main page, like /about.html.erb and wondering why it was telling me that it wasn't defined and that it didn't exist etc. Then it dawned on me, it was trying to find words/about as though about was an entry in my database, and not a website. So, I deleted the map.resources :words thing in my routes file and went to /about - there it is! Wahoo! Problem solved, onto bigger and better things. Not. Because doing that seems to break all of my other pages (doh) and I just can't take it anymore. Is there some way for me to escape the routes thing with link_to so that it doesn't try to go to about as an db entry? Better yet, is there a way for me to just remove the /say/ option entirely while keeping the other ones intact? That would really be ideal, since I don't particularly need a /say/ option and would really like to be able to make this thing link to other pages at the same time.
|
# ? Mar 26, 2010 02:25 |
|
Insurrectum posted:maybe some suggestions of any graphing packages to use. Do the graphing client side and use flot. The server side option would be something built on rmajgick, but unless things have changed in the last year or so, everyone hates rmagick. The March Hare posted:routes Post your routes and version of ruby, read Rails Routing from the Outside In, and run rake routes to see what all your link helper methods are and where they go.
|
# ? Mar 26, 2010 03:59 |
|
Pardot, thanks for the answer! I actually solved this last night after some dude in the official rails irc spoke at me in third person while distributing tons of links to me. That said, while I now have a better grasp of routing, I'm still going to read what you linked because I'd really like to understand this stuff 100%
|
# ? Mar 26, 2010 12:48 |
|
|
# ? Apr 19, 2024 21:29 |
|
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. There's also Google's charts API static http://code.google.com/apis/chart/image_charts.html dynamic http://code.google.com/apis/visualization/interactive_charts.html
|
# ? Mar 26, 2010 18:10 |