I'm trying to get MySQL installed to the latest version due to some installation going wrong somewhere along the line. I run the command gem install mysql and I receive the following:
Building native extensions. This
could take a while... ERROR: Error
installing mysql: ERROR: Failed to
build gem native extension.
/S...
I have a form for creation new order. One order can include several products. Each product has a price. Order's price equals to sum of prices of all product, included into it.
My form needs to update order's price, as user sets a quantity for each of the products.
Ideas ?
...
I'm trying to create a simple search form in Rails, but I think I'm missing something.
I have a named route for search:
map.search ":first_name/:last_name", :controller => "home", :action => "search"
I'm trying to use that in my search form:
<% form_tag(search_path, :method => 'get') do %>
<%= text_field_tag(:first_name) %>
<%= ...
Hi everyone,
I have installed Ruby 1.9.1 recently. Everything went fine, I installed the devkit, gems, rails and decided to use RadRails IDE. But, when I typed "ruby script/server" command, I got the error message telling me that msvcrt-ruby18.dll was not found. Still, I was able to run the WEBrick server. I also tried to open "http://lo...
Is there any better alternative to this?
name.gsub('è','e').gsub('à','a').gsub('ò','o').gsub('ì','i').gsub('ù','u')
thanks
...
How can I make a many-to-many relationship with the same model in rails?
For example, each post is connected to many posts.
...
I had asked an earlier question which did not get any replies.
Basically I get an error invalid database url when I try to do heroku db:push
So I figured I can try explicitly providing the database url.
so I tried
heroku db:push postgres://postgres@localhost/myrailsdb
but that gave error:
Failed to connect to database:
Sequel::...
I'm now developing comment system for my site on Ruby on Rails.
I try to make comments to be appeared when user click on SEE MORE button.
I see this is not like we do in pagination, so I need your little help guys!
When all comments have been displayed, the SEE MORE button should be removed from the page.
...
I think this may be a common situation… I'm working on a password recovery system for a Rails app that sends a link to the user to trigger a new password form. Pretty standard stuff.
On my development server I don't have any mail-sending software enabled or configured (sendmail, SMTP settings, etc.) In config/environments/development.rb...
I have a URL like below
/pages/edit_product/11
In my action edit_product how can I get the id 11 So that I can do @p = Product.find_by_id(11)
...
I have an action that saves new procucts like this:
@products = Product.new(params[:product])
@products.save
I am calling the same action for editing a product as well. But each time I edit...a new product gets created (because of above statements).
A while back I had seen some function that will only create a new record if there i...
The attributes method returns a hash of all the attributes with their names as keys and the values of the attributes as values; I want to utilize this method, creating a new derivative of the update_attributes(attributes) method, lets call it jz_attributes(attributes).
Update_attributes does this:
def update_attributes(attributes)
s...
I can't figure out what I'm overlooking, perhaps it's obvious or lack of understanding.
The app I'm working with uses subdomains which on the hosting server work properly. I figured locally installing would kick up some issues around routing, so I read up on making changes to /etc/hosts and using the Ghost gem. Both seem to work fine i...
I have an app with the following models: User, Task, and Assignment. Each Assignment belongs_to a User and a Task (or in other words, a Task is assigned to a User via an Assignment).
Once a User completes a Task, the Assignment is marked as complete, and the app immediately creates a new Assignment (or in other words, assigns the task t...
Hey guys..this is kind of a weird question but I'm making a webapp in rails and I have about half the functionality I'd like to see completed. Now I've been here before but due to misnaming some model and controllers everything went haywire so I just restarted the app since I knew I already did.
I'm wondering if I can "save game" wh...
I am seeing a very strange issue with a simple controller method. Either I am missing something fundamental or I am encountering a bug. My bet is on the former.
I have a Thing model with a ThingController.
A Thing has two variables, name and display, both strings.
ThingController (code below) has a method toggle_display, that toggles...
I have a twitter style application whereby a user follows many people.
This is achieved using a self-referential association.
This all works very nice but my brain has just gone dead while trying to figure out the active record syntax needed to list status updates (posts) from people the user follows ordered by time in a single query.
...
In InstantRails:
I click Manage Rails Applications, check Shovell, click Start with Mongrel, visit http://localhost:3000, click Submit a new story!, type login information, click login, the Ruby Console Window closes, I can't login and Firefox outputs Connection Restarted.
or
I click Open Ruby Console Window, type cd Shovell, type rub...
I have a model called Post, with a column called vote, and it has a big number of posts
I want to select n posts randomly that have >=x votes. n is very small compared to the number of posts
What is the best way to do this? I've tried a couple of ways that seem to be very inefficient. Thanks
...
I have a many to many relationship in rails. All database tables are named accordingly and appropriately. All model files are plural and use underscore to seperate words. All naming comventions are followed by ruby and rails standards. I'm using has many through in my models like this:
has_many :users, :through => :users_posts #Post...