Saturday, June 18, 2011
On this last part I was correct. I just went through the beginning part, which walks me through generating a scaffold for the project, then some styling to spruce the code up a bit and I already found a couple of ideas I want to apply to Chorenivore.
This is something I need to be doing every time I'm doing a tutorial or looking at code. What can I do with this? How does this apply to my projects?
Something funny I noticed this morning: back when I was learning CSS, I had a hard time understanding what a class was. And now with Rails, it's something I don't even think about. I don't know if I've just seen it often enough that I get it now, or if Rails has so many other things that are more complex that it just doesn't register. Probably a mixture of both, I'm guessing!
I felt a bit lazier this week, because I feel like Chorenivore is about as done as it's going to be for now and I didn't feel like digging back into Agile Web Development with Rails. What do you guys do to stay motivated when you're between projects like this? Does that even happen to more experienced Rails developers?
Oh and one last thing. Eli emailed me asking what happened to my old blog. I didn't realize switching from rubymeltdown.blogspot.com to codeitlikeyoustoleit.blogspot.com would DESTROY all my followers, so I put another blog up on rubymeltdown.blogspot.com, redirecting people to this blog. That should take care of that problem!
Tuesday, June 14, 2011
Unfortunately, what I didn't realize is that the very next page after I'd left off walked me through using Rails console to add a user. Still, it's not like I've been lax in the two months since I looked at this program, right?
So now I'm back on track. Right now I'm working on translation to different languages based on location. Interesting, though I don't know how practical this will be. My current plan is to finish up this book, mostly because I'm kind of sick of hopping around between projects. Then again, when is a project ever really done? Hopefully inspirato will strike between now and then and I'll either think of something new to do with Chorenivore, get back to work on Manticore, or create another app! I actually might go back and do more work with Ruby itself. I've been on that Rails tip for a while now.
Remember when I said I think more about what the code is doing when I follow a guide now? Completely true. While backtracking through Agile Web Development with Rails, trying to figure out where I'd left off, I found myself thinking about the code as I worked. Digging around in the deep, smelly guts of a Rails application isn't as intimidating as it once was. Sometimes I feel like I'm progressing really slowly, while other times I'm amazed at how far I've come in the nearly 5 months I've been working with Ruby on Rails.
Bruce Lee said "A man must constantly exceed his level." Does anyone else read that and immediately apply it to Rails?
Constantly leveling up.
Sunday, June 12, 2011
After a few google searches, I found this is a fairly common problem. However, none of the solutions I found fixed my problem entirely, but a combination of suggestions DID fix the problem.
Bingo! Once again, my :delete method works, and my flash[:notice] script is working, too.
Now for a little question.
You may recall my previous question about passing multiple values to a hidden_field. David showed me this code:
finished? ? 'finished' : 'unfinished'
This goes in the Task model and defines these two statuses. However, I don't know how to call them and mark a Task as finished or unfinished then have that change updated in the view.
Here's the code I've got now:
<%= form_for(task) do |f| %>
<%= f.hidden_field :finished, :value => !task.finished %>
<% if task.finished %>
<%= image_submit_tag 'finished.png' %>
<% else %>
<%= image_submit_tag 'unfinished.png' %>
<% end %>
Basically, I want it to work this way: A new Task is defined as unfinished by default, a user can mark a task as finished by clicking on 'unfinished.png', or mark it as unfinished again by clicking on 'finished.png'. This change should mark the Task with that status, either 'finished' or 'unfinished.'
Will I need to update the table for Task and add this as a field? Or can this information be stored in the database just by using the hidden_field? I want to be able to manipulate Tasks based on whether they're marked as finished or unfinished later.
I didn't do much coding this weekend, but it definitely felt good to sit down and fix my Jquery problem after thinking about it most of the day today.