Search Results

Search found 15 results on 1 pages for 'user305270'.

Page 1/1 | 1 

  • JQuery: json to object?

    - by user305270
    var gallery = new TGallery([[{"image":{"updated_at":"2010-03-20T00:00:00Z","title":"dfgdfg","spam_reports":0,"by_profile_id":1,"comment_count":0,"id":1,"description":"htt","on_type":"profile","adult_reports":0,"on_id":1,"created_at":"2010-03-20T00:00:00Z"}]]); Then in the TGallery class I would like to convert the json object to a js object. thanks without a plugin if is possible... :)

    Read the article

  • Rails: foreign_key that is set with a CASE WHEN mysql statement

    - by user305270
    belongs_to :removed_friend, :class_name => 'Profile', :foreign_key => "(CASE WHEN friendships.profile_id = #{self.id} THEN friendships.friend_id ELSE friendships.profile_id END)" The self.id its not working too :s it should be the id of the profile that is triggered the action. Anyway the main problem is that this foreign_key is not working and i got a mysql error. please help.. thanks

    Read the article

  • MYSQL CASE WHEN PROBLEM

    - by user305270
    SELECT `profiles`.* FROM `profiles` INNER JOIN `friendships` ON `profiles`.id = `friendships`.(CASE WHEN friendships.profile_id = 1 THEN`friend_id` ELSE `profile_id` END) How can i make the inner join like profile.id = friendships.(here will select the one key that is needed) but it doesnt work. please help :P it cant be: `profiles`.id = (CASE WHEN friendships.profile_id = 1 THEN `friendships`.`friend_id` ELSE `friendships`.`profile_id` END)

    Read the article

  • Rails has_many conditions

    - by user305270
    c = "(f.profile_id = #{self.id} OR f.friend_id = #{self.id})" c += AND + "(CASE WHEN f.profile_id=#{self.id} THEN f.friend_id ELSE f.profile_id END = p.id)" c += AND + "(CASE WHEN f.profile_id=#{self.id} THEN f.profile_rejected ELSE f.friend_rejected END = 1)" c += AND + "(p.banned = 0)" I need this to be used in a has_many relationship like this: has_many :removed_friends, :conditions => ??? how do i set there the self.id?, or how do i pass there the id? Then i want to use the will_paginate plugin: @profile.removed_friends.paginate(:page => 1, :per_page => 20) Thanks for your help EDIT: class Profile < ActiveRecord::Base has_many :friendships has_many :removed_friends, :class_name => 'Profile', :through => :friendships, :conditions => "(friendships.profile_id = #{self.id} OR friendships.friend_id = #{self.id})" "AND (CASE WHEN friendships.profile_id=#{self.id} THEN friendships.profile_rejected ELSE friendships.friend_rejected END = 1)" + "AND (p.banned = 0)" end class Friendship < ActiveRecord::Base belongs_to :profile belongs_to :removed_friend, :class_name => 'Profile', :foreign_key => "(CASE WHEN friendships.profile_id = #{self.id} THEN friend_id ELSE profile_id END)" end

    Read the article

  • [Rails] Where to put this code?

    - by user305270
    [Rails] Where to put this code? I have a user1 and when another registered user2 sees the profile of user1, has some buttons on it: ['add as friend', 'give me your number', 'give me your email', 'ask her out', 'view photos']. The 1,2,3,4 are POST, with AJAX. Now, i have to make a new controller named 'ProfileActionsController' or i should put this code in the 'UsersController'? or maybe a another posiibility? thanks ;)

    Read the article

  • Mysql: i need to get the offset of a item in a query.

    - by user305270
    Mysql: i need to get the offset of a item in a query. I have a image gallery: this show 6 image per stack, so when i request image 22 it shows images from 18 to 24. It should first get the offset of the image 22, then get the images from 18 to 24. Another example: i request the image number 62(and offset 62), it will select images with offset from 60 to 66. Is possible with a single query? Thanks ;)

    Read the article

  • Jquery, AJAX and URL changes...

    - by user305270
    Jquery, AJAX and URL changes... I have a gallery, and when the image change i would like to change my url to "#image_id=321" and when i load an url with this appended: "#image_id=321", loads the image with id 321. is this possible to make without the "#" and using "/photo-id/321"? thanks

    Read the article

  • Rails and image gallery: how to make it flexible?

    - by user305270
    Hy! In my app, every profile has a gallery and this gallery has images. They can have 1 or 1000 images, so when i show up the gallery i only need a part of the images, let's say 12 images. Then in my ajax gallery when, someone requests more images are loaded. This gallery is SEO, so, the main url is: "/profile-url/" and then, there are these urls too: "/profile-url/images/1" that loads the image with the id=1 in the database. The gallery have to show only 6 images per stack, so When i request the page with the image.id=64, only have to show from 60 to 72, and to select the 64, that is done with js. how may i add a request like this? and how to order them? thanks

    Read the article

  • How to order the images in a mysql database?

    - by user305270
    Hy! Here is my problem: i have a profile and this profile has for example 100 images. When someone visit this profile the first image will be the first result of my query that sorts by updated_at. But if the user would want to put the image with the (id = 8) to be the first, then (id = 22) then (id = 88) and so on? I need to put another field or is really necessary a new table to make a custom sort on images? and maybe someone explain this to me how to do? thanks, i appreciate your help ;)

    Read the article

  • Rails more statements with ; doesnt work... :s

    - by user305270
    I have this code, but i cant make it work: images = Image.find_by_sql('PREPARE stmt FROM \' SELECT * FROM images AS i WHERE i.on_id = 1 AND i.on_type = "profile" ORDER BY i.updated_at LIMIT ?, 6\'; SET @lower_limit := ((5 DIV 6) * 6); EXECUTE stmt USING @lower_limit;') I got this error: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @lower_limit := ((5 DIV 6) * 6); EXECUTE stmt USING @lower_limit' at line 1: PREPARE stmt FROM ' SELECT * FROM images AS i WHERE i.on_id = 1 AND i.on_type = "profile" ORDER BY i.updated_at LIMIT ?, 6'; SET @lower_limit := ((5 DIV 6) * 6); EXECUTE stmt USING @lower_limit; but if i use a sql app, like this, it works: PREPARE stmt FROM ' SELECT * FROM images AS i WHERE i.on_id = 1 AND i.on_type = "profile" ORDER BY i.updated_at LIMIT ?, 6'; SET @lower_limit := ((5 DIV 6) * 6); EXECUTE stmt USING @lower_limit;

    Read the article

  • has_many conditions

    - by user305270
    c = "(f.profile_id = #{self.id} OR f.friend_id = #{self.id})" c += AND + "(CASE WHEN f.profile_id=#{self.id} THEN f.friend_id ELSE f.profile_id END = p.id)" c += AND + "(CASE WHEN f.profile_id=#{self.id} THEN f.profile_rejected ELSE f.friend_rejected END = 1)" c += AND + "(p.banned = 0)" I need this to be used in a has_many relationship like this: has_many :removed_friends, :conditions => ??? how do i set there the self.id?, or how do i pass there the id? Then i want to use the will_paginate plugin: @profile.removed_friends.paginate(:page => 1, :per_page => 20) Thanks for your help

    Read the article

1