merbalist
I’m going to write my own blog and migrate off of tumblr. I’ve been working with Ruby on Rails for a few months but feel it prudent to learn another Ruby framework named “Merb”.
I’m loving what I’m seeing with Merb so far.
3 years agoI’m going to write my own blog and migrate off of tumblr. I’ve been working with Ruby on Rails for a few months but feel it prudent to learn another Ruby framework named “Merb”.
I’m loving what I’m seeing with Merb so far.
3 years agoIf you’re trying to use “acts_as_rateable” bare in mind the tutorials I have found are not yet updated and posing some problems.
The first one I ran into was the migration generated in the tutorial. The tutorials I have found have you script/generate a migration which you add code to generate the ratings table. You need a rates join table as well, which isn’t included and will cause the obvious table “ratings” not found error.
I noticed “acts_as_rateable” has a migration task built in so instead of generating your own migration(s) just do:
./script/generate acts_as_rateable_migration
and everything will be A-OK
My rating controller, which only contains a rate action:
I removed the user stuff, im doing anon voting and dont want my users voting
I changed:
rateable.add_rating Rating.new(:rating => params[:rating], :user_id => @current_user.id)
TO
rateable.rate_it params[:rating], params[:session_id]
If you’re doing rate per user then params[:session_id] would be your current_user.id or whatever
Next for the partial referenced in the tutorial I changed the link_to_remote call to read:
<%= link_to_remote( "#{x}",
:url => { :controller => "rating", :action =>rate",
:id => asset.id, :rating => x,:rateable_type => asset.class.to_s},
:html => { :class => "#{@convert[x-1]}-stars",
:name => "#{pluralize(x,'star')} out of 5",:title => "Rate this a #{x} out of 5" } ) %>
Next I added a route to routes.rb (I just need the /rate for my app - nothing more)
map.rate '/rate', :controller => 'rating', :action => 'rate'
Taking the original tutorial, applying these few changes, rendered me a slick 5-star rating system for my models.
3 years ago4 Rails apps are in various stages of completion with one being capified and deployed over the weekend to slicehost.
My initial thoughts:
-Ruby Enterprise Edition DID provide a noticeable performance increase in production.
-Capistrano is by far one of my favorite administration tools.
-Working with Ruby on Rails was 110% times more relaxing than Visual Studio or Delphi. I was focused on providing what the user needs the app to do rather than how to make the app do it. I didn’t have to figure out if I wanted to use datasets, write a data access layer, or use an OPF framework. I didn’t have to configure much of anything.
It didn’t go without its quirks though
-Remember to get your permissions correct on your public folder and it’s subfolders
-If you, like me, are allowing users to upload files to a folder in the app make sure it gets symlinked to the shared directory so each deployment doesn’t blow up the uploads
-Remember to run rake db:migrate in PRODUCTION mode. Rather than set RAILS_ENV to production i just ran rake db:migrate RAILS_ENV=production or script/console production.
-Prepare to find bugs even though your development box is a-ok and your tests pass.
I’m now a Rails advocate through doing actual work. Ruby is a big factor as it’s a GREAT language. Slow you say? The speed is coming and it’s coming soon.
CSS/(X)HTML? Still not great at these - so my applications do not look great - but they sure as hell WORK as I tell them.
3 years agoI was out eating for a friend’s birthday Saturday night. Barack Obama was apparently staying at the hotel attached to the restaraunt we were eating at - cops walking the parking not admitting Obama was staying there while smiling at the same time.
My Fiance: “Is Obama staying here???”
Cop: :smiles: nooooooo
My Fiance: “Do you think he’ll come out?”
Cop: No
Redneck Friend: If McCain was here he would come out
Cop: Yah he probably would
Redneck Friend: Because McCain loves the American people and Obama is just a black terrorist
woahh…..what?
After talking to some of my country friends I came to realize that yes, these guys DO hate Obama because he’s black and DO think he’s a “terrorist” becaues of his name.
It reminds me of the Bush vs Kerry election. A friend of mine was put off because Kerry seemed like a puss, couldn’t throw a football like a man, and couldn’t possibly do right in Iraq. Bush gets elected for term #2 - now look at us.
I ask these dudes - “If McCain croaks and Palin is now in charge, that doesn’t BOTHER you a little because she’s a clone of Bush?”
Response? “She’s hot”
I’m in a constant state of abject horror at what I hear each election year…no talk of policy here..just jesus,guns,gays,who’s more patriotic, “christ he’s black, can’t vote for him”, etc.
True, Obama would probably decide a lot of my firearms are destructive devices and want to ban them. I’m much more concerned about the country in general. I could give my Saiga-12 semi automatic, magazine fed, 12 gauge up for financial prosperity. Wether or not a gay can get married has never ONCE affected ME. The fact that George Bush is totally down with Jesus has not helped him do right for this country one bit.
Guns? Yah that’s an issue, but I can handle some legislation in this area so long as it’s not a total ban of firearms.
Abortion, Gay Marriage, Jesus, Race - Seem to be typical “Republicans kind of suck now days, we have no platform, so lets take the redneck’s anger about issues such as finances and the economy, turn it around on the blacks, gays, etc and get their votes” - It’s been working.
Bill Maher recently said “American is no longer #1, stop acting like we’re still #1 and focus on getting us back to #1”. I agree.
3 years agoI’ve taken a break from Rails to just learn Ruby - have some programs I can make in Ruby for systems administration and some task automation - doing this has produced a TON of lightbulb moments relating to Rails. I don’t like dealing with Rails magic and not understanding what’s going on - so I’ve also been reading rails source here and there.
After hearing a Rails podcast featuring a talk from Jim Weirich about concurrent programming and Erlang I’m now compiling Erland on my macbook.
$ erl
Erlang (BEAM) emulator version 5.6.4 [source] [smp:2] [async-threads:0] [kernel-poll:false]
Eshell V5.6.4 (abort with ^G)
1>
There it is. Apparently Erlang’s, and some other languages around, handle concurrent programming outside of your typical thread model - and these seem to make more sense to me.
Why do Erlang? Why learn something else d00d?
Anytime I jump into some new kind of development, a new language, whatever - I get a ton of ideas that I apply back to current projects. I think it’s a great thing to do, if you have the time. I technically don’t but I do feel languages that do concurrent code well will end up being towards the top of my list for developing as systems begin to see less single core speed increases…”Now that we’ve neared the physical limitations of the cpu, lets just add a ton of cores to the chip”
Look I’m not saying “ditch Ruby, it just can’t shake the threaded model for concurrent programming” I _KNOW_ concurrent programming is hard, I’ve had my share of lock problems and shared memory stomping all over the place when it shouldn’t, thread based concurrent programming is HARD to get right ALL the time..and unfortunately is pretty much HAS to be right all the time.
I’m still convinced Ruby is a break through language..its just too damn fun to code with..and does a ton of work for me with little code.
I’m also lightly learning Java - just as an exercise - I never plan to use Java..I think learning Ruby..the Rails frame, Erlang, Python and maybe the Django framework will give me plenty of nice tools to tackle projects.
3 years agoI have to rant about this.
I know people think wether or not a given..what’s the right word…develomental approach..yah..wether or not a given developmental approach to a problem is “scalable” or not. Ever since I decided to skinny dip in the pool known as Ruby on Rails I’ve been reading countless blogs/forum posts/tattoo’s on the ass of a fat girl/etc about how Rails “doesn’t scale” - are these people INSANE?
If there was a fucking “scalable” silver bullet approach to application development - everybody would be using it. _NOTHING_ fucking scales..especially when you leave what you intend to scale undefined.
First of all, if you’ve been fortunate enough to work on a project that runs INTO scaling issues, you finally realize scaling is turning into a buzzword. Anytime I run into what people consider a scaling issue it’s REALLY just a design or architectural bottleneck..it could be your ass end database..maybe it’s parser is fucking up OR statements in your WHERE clause..perhaps HAVING is better for your application..
MAYBE the language the app is written in is interpreted and a tad slower than need me..perhaps there’s a fix.
Maybe YOU layed the design out in a fashion that lends itself to failure.
I’ve ran into ALL of the above..and NEVER once could I have said “Given the same set of problems, if I would’ve used Java or Django/Python - this would not have happened”
As you experience growth, you’ll run into issues that you can define as “an issue of scalability” - you can fix it..you may need to handle it with hardware, refactoring, or sexual relations with a chimp - but YOU CAN FIX IT.
Does Java scale? no
Rails? no
COBOL? no
A Prius? no
Metal music? Yah..actually music DOES scale due to “fusion”. Mix Jazz & Metal..boom..music has just scaled to take care of the needs of weirdos like me.
Mix Rails with Java? Fusion - it might solve a problem..it might piss you off..who knows.
bap.
3 years agoHell?
I’ve obviously realized that since I don’t have a design department..or even a designer staffed..developing web applications means I have to learn things like CSS, proper semantic HTML, and Ajax. The realization hit me HARDER than ever just now though.
See, I was having some issues with Rails earlier. I come from a non framework background..Rails..Django..you name it - they do some magic for you. It’s difficult to document magic. For example, I _JUST_ not found out that the find_or_create_by_ “dynamic attribute-based finder”..what the HELL?
Rails dynamically generates “finders” for my objects? I can declare a People model with an age column, and do Person.find_by_age(30)? _YES_. Rails just examines my model and makes these dynamic finders based on attributes - some of which can optionally CREATE a new instance!
THIS crap I’m not used to AT ALL.
Of course…I have to learn CSS so my application(s) will look ok. USERS like Ajax, they don’t know it’s named Ajax..they don’t know what asynchronous anything is..but what Ajax provides, users love.
So my friends, even with dynamically created finder methods - I’m stuck learning CSS and dealing with Ajax.
3 years agoToday we built and distributed an update of our application - only to find out through lack of proper testing a piece of test data got out..a bad piece of test data…
OH WELL
Today I learned what Ruby symbols actionally _ARE_ - symbolic references to a single string..VERY useful if you had a hash of say { ‘first_name’ => ‘Bob’} . Chances are the string containing first_name will be re-used a bunch - no need to have a new string created each time you hash out a person’s name. use :first_name => ‘Bob’ instead.
Prototype of my FIRST Rails app is ready on the backend (front end still needs work). Tonight I learn how to deploy with Capistrano.
Details on that later.
3 years agoWhen converting something like Dr Dispatch from a desktop C/S Win32 application to a web application accessed via a browser a few questions have come up.
1) Reporting? I think I’ve found the closet thing to answer with Ruports
2) Migration? - What’s the easiest method to import desktop application data into the new rails app? Am I looking at dumping to CSV and importing? Seems like I read somewhere I can load csv files into active record?
3) What’s the BEST way to get the Windows app talking with a rails app (for another project semi-related to the port)? Something like SOAP?
Ideas?
3 years ago